Re: MFC Static vs Dynamic Link
"JCO" <someone@somewhere.com> wrote in message
news:eTF5sRk4KHA.3880@TK2MSFTNGP04.phx.gbl...
VS 2008; C++
When creating a dialog application using MFC, I have the option to:
1. Use MFC in a Shared DLL
2. Use MFC in a Static Link DLL
Can someone tell me the difference in the two?
Static linking puts all the MFC code into your .exe. Shared DLL has the MFC
code in the other DLL's which you must distribute along with your .exe. If
you are creating additional MFC DLL's besides your .exe, you will need to
use shared dll, static linking is not an option (and you wouldn't want to
put MFC into both the .exe and .dlls anyway as that is wasteful).
Can I change from one to the other while I'm still have programming to do?
Sure, I think you will find it doesn't really matter which one you use for
programming.
Will one of these options allow my Released Version of my Executable to
run on another computer alone (without transferring a DLL to the other
computer)?
Static linking obviously is easier, you only have to distribute your single
..exe and that's it. Shared DLL's is not much harder using "app local
deployment" - you can create one folder containing both your .exe and the
MFC DLL's. There are further options to use .msi merge modules or
vc_redist.exe to globally install the DLL's onto the user's windows\system32
folder, but that requires use of an installer and is more complicated than
the first options that only need xcopy deployment.
Also; if I need to take DLL's with me to run my dialog, how can I tell
what DLL's I need?
Run depends.exe (google it). Also to make sure, I use a virtual machine
containing only the OS installed and no apps and make sure my app runs in
it.
-- David