New feature for MFC vNext: small statically linked dialog based and console apps
November 15, 2011 1 Comment
If you’ve read my blog in the past, you’ve noticed that I’ve written several articles relating to reducing the size of statically linked MFC apps. Ever since the feature pack classes were added to MFC (in 2008 SP1) there have been various regressions that caused even the simplest of MFC applications to be super-large when building a release version.
In vNext, Microsoft has attempted to address this issue by adding a new define: _AFX_NO_MFC_CONTROLS_IN_DIALOGS that basically says: I know that I will not have any of the “feature pack” controls in my app, so don’t link any code into the app that I’m not going to need.
From my testing so far, it only appears to work in console apps and MFC Dialog based apps. If you use it with a single document interface app, it will fail with a linker error.
The sizing results are dramatic, and I suggest you give the define a try if you are using MFC vNext and have a statically linked app.