X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/13bdd545fb305e02f9ff4ac8048fb0e4e8f2efd5..cb73e6001f891ae46b12a1e4ca39b93649cb6099:/src/msw/main.cpp?ds=inline diff --git a/src/msw/main.cpp b/src/msw/main.cpp index dc59e37587..9f96ac237c 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation #endif @@ -55,9 +55,6 @@ // function prototypes // ---------------------------------------------------------------------------- -// from src/msw/app.cpp -extern void WXDLLEXPORT wxEntryCleanup(); - static wxChar **ConvertToStandardCommandArgs(const wxChar *p, int& argc); // ============================================================================ @@ -68,10 +65,10 @@ static wxChar **ConvertToStandardCommandArgs(const wxChar *p, int& argc); // Windows-specific wxEntry // ---------------------------------------------------------------------------- -int wxEntry(HINSTANCE hInstance, - HINSTANCE WXUNUSED(hPrevInstance), - char *pCmdLine, - int nCmdShow) +WXDLLEXPORT int wxEntry(HINSTANCE hInstance, + HINSTANCE WXUNUSED(hPrevInstance), + char *pCmdLine, + int nCmdShow) { // remember the parameters Windows gave us wxSetInstance(hInstance); @@ -98,17 +95,7 @@ extern "C" // Note that WinMain is also defined in dummy.obj, which is linked to // an application that is using the DLL version of wxWindows. -#if !defined(_WINDLL) - -int PASCAL WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); -} - -#else // _WINDLL +#if defined(_WINDLL) // DLL entry point @@ -137,7 +124,7 @@ DllMain(HANDLE hModule, DWORD fdwReason, LPVOID WXUNUSED(lpReserved)) return TRUE; } -#endif // _WINDLL/!_WINDLL +#endif // _WINDLL } // extern "C" @@ -162,7 +149,9 @@ wxChar **ConvertToStandardCommandArgs(const wxChar *p, int& argc) // and +1 here for the terminating NULL wxChar **argv = new wxChar *[argc + 1]; - argv[0] = new wxChar[MAX_PATH]; + // as we use wxStrdup below we must allocate the first argument using + // malloc(), not new[], as well + argv[0] = (wxChar *)malloc(MAX_PATH * sizeof(wxChar)); ::GetModuleFileName(wxhInstance, argv[0], MAX_PATH); // copy all the other arguments to wxApp::argv[]