In MFC, wWinMain is defined in appmodul.cpp. This file is built into mfc90ud.dll from what I can see. However, when I run my application, the call stack shows MyApplication.exe!wWinMain. How has it taken the wWinMain function that was exported in appmodul.obj and placed it in my application?
In MFC, wWinMain is defined in appmodul.cpp . This file is built into mfc90ud.dll
Share
Right-click your project in the Solution Explorer window, Properties, Linker, Command Line. Type /verbose in the “Additional Options” box. Rebuild your project. The Output window now shows a trace of where the linker found a symbol. Search it for “winmain” to find this:
Note the library name, mfcs90ud.lib is a static link library. If you search for “mfcs90ud.lib” then you can also see how that library got referenced:
If you search the MFC source code for “mfcs”, you’ll find how this /defaultlib option got injected. From afx.h:
Long story short, an MFC app links two libraries. Mfc90u.lib is the import library for the DLL version of MFC. Mfcs90u.lib is a static link library that contains the bits that get linked into your executable. Including WinMain().