Static vs. Dynamic linking w/ MFC
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Static vs. Dynamic linking w/ MFC

  1. #1
    Join Date
    Apr 1999
    Posts
    37

    Static vs. Dynamic linking w/ MFC

    Hi, I have a doc/view app that I've always dynamically linked with MFC. I'm thinking about linking it statically, but I tried that and it compiles and links, but will not run. What are the 'gotchas' for static linking MFC?

    cheers,
    -Matt


  2. #2
    Join Date
    Jun 1999
    Posts
    315

    Re: Static vs. Dynamic linking w/ MFC

    why link it staticly? just makes bigger code. do you have other reasons it needs to be staticly linked?

    miked

  3. #3
    Join Date
    Apr 1999
    Posts
    27,427

    Re: Static vs. Dynamic linking w/ MFC

    This is not totally true if you are going to distribute the application to a large audience of people who may or may not have the necessary DLL's. A statically linked EXE with MFC is much smaller than a dynamically linked version *plus* all of the DLL's that are needed to get the application working. I statically linked an MFC application and it was less than 300K.

    Regards,

    Paul McKenzie


  4. #4
    Join Date
    Apr 1999
    Posts
    37

    Re: Static vs. Dynamic linking w/ MFC

    To clarify, I need to link statically with MFC because I'm linking with other libraries that depend on libc.lib. libc.lib clashes with msvcrt.lib, and if I ignore msvcrt.lib, I will be missing a couple of symbols I need to link. Linking statically *should* solve this problem. I also want to link statically, because I've had problems with different users that have different versions of the MFC dlls on their computers, and my app will work on some, and not on others. Linking statically will solve that problem.

    cheers,
    -Matt


  5. #5
    Join Date
    Apr 1999
    Posts
    27,427

    Re: Static vs. Dynamic linking w/ MFC

    The only sane move on your part. Read my post. It sounds almost exactly like yours.

    Regards,

    Paul McKenzie


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center