// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation
#endif
// function prototypes
// ----------------------------------------------------------------------------
-// from src/msw/app.cpp
-extern void WXDLLEXPORT wxEntryCleanup();
-
static wxChar **ConvertToStandardCommandArgs(const wxChar *p, int& argc);
// ============================================================================
// Windows-specific wxEntry
// ----------------------------------------------------------------------------
-int wxEntry(WXHINSTANCE hInstance,
- WXHINSTANCE 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)hInstance);
+ wxSetInstance(hInstance);
wxApp::m_nCmdShow = nCmdShow;
// parse the command line
// 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((WXHINSTANCE) hInstance,
- (WXHINSTANCE) hPrevInstance,
- lpCmdLine,
- nCmdShow);
-}
-
-#else // _WINDLL
+#if defined(_WINDLL)
// DLL entry point
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
- return wxEntry((WXHINSTANCE) hModule);
+ return wxEntry(hModule);
case DLL_PROCESS_DETACH:
wxEntryCleanup();
return TRUE;
}
-#endif // _WINDLL/!_WINDLL
+#endif // _WINDLL
} // extern "C"
// 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[]