X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b568d04ffa191f9e3b643ca33526094eca0ba304..dd107c50be43e8d4dbdba20df162faf119a3781c:/src/msw/main.cpp diff --git a/src/msw/main.cpp b/src/msw/main.cpp index cfa9a598c9..1ee977b104 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -33,6 +33,9 @@ #include "wx/msw/private.h" +// from src/msw/app.cpp +extern void WXDLLEXPORT wxEntryCleanup(); + // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -64,26 +67,21 @@ HINSTANCE wxhInstance = 0; #if !defined(_WINDLL) #if defined(__TWIN32__) || defined(__WXWINE__) + #define HINSTANCE HANDLE -extern "C" -BOOL PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) - -#else - -#ifdef __WATCOMC__ -int PASCAL -#else -int APIENTRY -#endif - - WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) -#endif -// __TWIN32__ + extern "C" +#endif // WINE +int PASCAL WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) { - return wxEntry((WXHINSTANCE) hInstance, (WXHINSTANCE) hPrevInstance, lpCmdLine, nCmdShow); + return wxEntry((WXHINSTANCE) hInstance, (WXHINSTANCE) hPrevInstance, + lpCmdLine, nCmdShow); } -#endif + +#endif // !defined(_WINDLL) ///////////////////////////////////////////////////////////////////////////////// // DllMain @@ -100,22 +98,27 @@ BOOL WINAPI DllEntryPoint (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) #endif { +#ifndef WXMAKINGDLL switch (fdwReason) { case DLL_PROCESS_ATTACH: // Only call wxEntry if the application itself is part of the DLL. - // If only the wxWindows library is in the DLL, then the initialisation - // will be called when the application implicitly calls WinMain. - -#if !defined(WXMAKINGDLL) + // If only the wxWindows library is in the DLL, then the + // initialisation will be called when the application implicitly + // calls WinMain. return wxEntry((WXHINSTANCE) hModule); -#endif - break; case DLL_PROCESS_DETACH: - default: - break; + if ( wxTheApp ) + wxTheApp->OnExit(); + wxEntryCleanup(); + break; } +#else + (void)hModule; + (void)fdwReason; +#endif // !WXMAKINGDLL + (void)lpReserved; return TRUE; }