12.2. How should I define the WEP in a MFC DLL?
In a dynamic-link library (DLL) built with Microsoft Foundation Class Library version 2.0, the _USRDLL model uses the WEP() (Windows exit procedure) function provided in the C run-time library. Because the code uses the C library WEP() function, the destructors for static and global objects in the DLL are called and the CWinApp::ExitInstance() function for the DLL application object is called.
See MSVC Knowledge Base article Q98374 and Tech notes 11 and 33.
MSVC Knowledge Base 6/7/95