Link to home
Start Free TrialLog in
Avatar of NoviceAndGood
NoviceAndGood

asked on

Shared or Statically Linked MFC?

Hi! Everybody.
         While making a MFC application using the App Wizard, in the 5th step (Visual C++ 5.0), it asks ::
=====
How would you like to you the MFC library?
1). As a shared DLL?
2). As a statically linked library?
=====

What are these options and how can they affect the development of my project? Also when can I use them (i.e. are there any restrictions on when can I use one method over the other and vice-versa).
Avatar of Lischke
Lischke

Hi Novice,

you should ask this question in the C forum, this is more appropriate. We are talking here about Windows programming.

Ciao, Mike
There is an MFC forum.
Statically linked means that the linker will add all the MFC functions that your programm uses to executable itself.
Dynamically linked means that Windows will link the MFC functions from a DLL (dynamic link library).
Several different programs can share one Dynamic Link Library, which theoretically means that less executable code needs to be installed on the users computer (if I look in my system directory this approach seems to have failed...). The disadvantage is that you have to ensure that those DLL's are installed on the user's computer.

ASKER CERTIFIED SOLUTION
Avatar of mikeblas
mikeblas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also, I should point out that, if you're planning a system involving an EXE and some DLLs, you'll save working set by linking to a shared version of MFC.

If you have YOURAPP.EXE, 1.DLL and 2.DLL, all using MFC, you'll have these things in memory if you statically link:

   YOURAPP.EXE + static MFC
   1.DLL + static MFC
   2.DLL + static MFC

If you dynamically link, you'll just have this:

   YOURAPP.EXE
   MFC.DLL
   1.DLL
   2.DLL

At some point in these cases (usually pretty quickly--for only 2 or three DLLs) dynamically linking will be cheaper.

..B ekiM
Avatar of NoviceAndGood

ASKER

Thanks mikeblas.