X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/822e03eeffe940efdcae10f44f46bd49e6f76131..bcd882b35e56a43f894551a43bbc4937034b7a0b:/wxPython/src/helpers.cpp diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 2a568e3e38..1a23c8f8d6 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -97,6 +97,7 @@ PyObject* wxPyPtrTypeMap = NULL; // This gets run when the DLL is loaded. We just need to save a handle. //---------------------------------------------------------------------- +extern "C" BOOL WINAPI DllMain( HINSTANCE hinstDLL, // handle to DLL module DWORD fdwReason, // reason for calling function @@ -400,13 +401,17 @@ void wxPyApp::_BootstrapApp() int argc = 0; char** argv = NULL; blocked = wxPyBeginBlockThreads(); + PyObject* sysargv = PySys_GetObject("argv"); - if (sysargv != NULL) { - argc = PyList_Size(sysargv); + PyObject* executable = PySys_GetObject("executable"); + + if (sysargv != NULL && executable != NULL) { + argc = PyList_Size(sysargv) + 1; argv = new char*[argc+1]; + argv[0] = PyString_AsString(executable); int x; - for(x=0; x