Compiler Question: Use of MFC : Use Standard Windows Libraries
-
I have a basic MFC dialog based app so I am definitely using MFC. The official documentation says, "Non-MFC projects can select Use Standard Windows Libraries to link to various Win32 libraries that are included when you use MFC". The implication is that you could not build / link / run an MFC application if you chose this compiler option, right? However, you can build and run an MFC application with this option. What I want to know is, what is really going on or why does an MFC application work? If I use this option can I be free of MFC DLL dependencies? I have spent some time googling this, but I can't find any answers to this question.
-
I have a basic MFC dialog based app so I am definitely using MFC. The official documentation says, "Non-MFC projects can select Use Standard Windows Libraries to link to various Win32 libraries that are included when you use MFC". The implication is that you could not build / link / run an MFC application if you chose this compiler option, right? However, you can build and run an MFC application with this option. What I want to know is, what is really going on or why does an MFC application work? If I use this option can I be free of MFC DLL dependencies? I have spent some time googling this, but I can't find any answers to this question.
Hi Deep, Your understanding is almost correct. From visual studio project settings we can select 3 options "Use Standard Windows Libraries", "Use MFC in a Static Library"and "Use MFC in a Shared DLL". The first one[Use Standard Windows Libraries] is used when we had an application or a dll that did not require MFC class or framework support. For example a console application or pure c++ libraries or a win32 application or a C application etc. The second and third options are used where we need MFC class or framework support e.g: MFC dialog application, MFC SDI or MDI application or applications using CString etc. The difference between "Use MFC in a Static Library"and "Use MFC in a Shared DLL" is given below in simple sentence. If you need to run your application in another computer that did not had a Visual Studio run time, you should choose static library other wise use shared dll. And you can find more difference between these two from net http://msdn.microsoft.com/en-us/library/1ez7dh12(v=vs.80).aspx[^] http://stackoverflow.com/questions/2652679/regular-dll-using-mfc-shared-vs-mfc-statically-linked[^]
-
Hi Deep, Your understanding is almost correct. From visual studio project settings we can select 3 options "Use Standard Windows Libraries", "Use MFC in a Static Library"and "Use MFC in a Shared DLL". The first one[Use Standard Windows Libraries] is used when we had an application or a dll that did not require MFC class or framework support. For example a console application or pure c++ libraries or a win32 application or a C application etc. The second and third options are used where we need MFC class or framework support e.g: MFC dialog application, MFC SDI or MDI application or applications using CString etc. The difference between "Use MFC in a Static Library"and "Use MFC in a Shared DLL" is given below in simple sentence. If you need to run your application in another computer that did not had a Visual Studio run time, you should choose static library other wise use shared dll. And you can find more difference between these two from net http://msdn.microsoft.com/en-us/library/1ez7dh12(v=vs.80).aspx[^] http://stackoverflow.com/questions/2652679/regular-dll-using-mfc-shared-vs-mfc-statically-linked[^]
-
If my understanding is correct, then why can I build and run an MFC based Dialog application using the standard windows libraries? I have actually set this application to use the standard libraries and hit build and run and it does. So why does this work?
Because an MFC project will automatically include any dependent MFC libraries.
-
Because an MFC project will automatically include any dependent MFC libraries.
-
Ok, thanks that explains that. So is this linked version closer to the MFC-Static mode or shared DLL mode?
I think the majority of the standard libraries are DLL's as they are installed by default on all Windows systems.
-
I think the majority of the standard libraries are DLL's as they are installed by default on all Windows systems.
Thanks for all your help. I think I understand now. I would assume an MFC application compiled with Standard Windows Libraries would still be dependent upon various MFC dlls such that the end users machines might still need the VC redistributable package installed, where as the Static MFC linking gets by that requirement. In other words, going with Standard Windows Libraries buys me nothing unless I am genuinely MFC free.
-
Thanks for all your help. I think I understand now. I would assume an MFC application compiled with Standard Windows Libraries would still be dependent upon various MFC dlls such that the end users machines might still need the VC redistributable package installed, where as the Static MFC linking gets by that requirement. In other words, going with Standard Windows Libraries buys me nothing unless I am genuinely MFC free.
Yes, I think that's about it.