We don't need to dlopen the app module before the LoadLibrary().
This commit is contained in:
parent
da7d5ac699
commit
7e264690cf
|
@ -173,33 +173,15 @@ static const char *wrapper_code =
|
||||||
"int WINAPI main(int argc, char** argv, char** envp)\n"
|
"int WINAPI main(int argc, char** argv, char** envp)\n"
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" void* appLibrary;\n"
|
|
||||||
" HINSTANCE hApp = 0, hMFC = 0, hMain = 0;\n"
|
" HINSTANCE hApp = 0, hMFC = 0, hMain = 0;\n"
|
||||||
" void* appMain;\n"
|
" void* appMain;\n"
|
||||||
" char* libName;\n"
|
|
||||||
" int retcode;\n"
|
" int retcode;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" /* Load the application's library */\n"
|
|
||||||
" libName=(char*)malloc(2+strlen(appName)+3+1);\n"
|
|
||||||
" /* FIXME: we should get the wrapper's path and use that as the base for\n"
|
|
||||||
" * the library\n"
|
|
||||||
" */\n"
|
|
||||||
" sprintf(libName,\"./%%s.so\",appName);\n"
|
|
||||||
" appLibrary=dlopen(libName,RTLD_NOW);\n"
|
|
||||||
" if (appLibrary==NULL) {\n"
|
|
||||||
" sprintf(libName,\"%%s.so\",appName);\n"
|
|
||||||
" appLibrary=dlopen(libName,RTLD_NOW);\n"
|
|
||||||
" }\n"
|
|
||||||
" if (!appLibrary) error(\"Could not load the %%s library: %%s\", libName, dlerror());\n"
|
|
||||||
"\n"
|
|
||||||
" /* Then if this application is MFC based, load the MFC module */\n"
|
" /* Then if this application is MFC based, load the MFC module */\n"
|
||||||
" /* FIXME: I'm not sure this is really necessary */\n"
|
|
||||||
" if (mfcModule) {\n"
|
" if (mfcModule) {\n"
|
||||||
" hMFC = LoadLibrary(mfcModule);\n"
|
" hMFC = LoadLibrary(mfcModule);\n"
|
||||||
" if (!hMFC) error(\"Could not load the MFC module %%s (%%d)\", mfcModule, GetLastError());\n"
|
" if (!hMFC) error(\"Could not load the MFC module %%s (%%d)\", mfcModule, GetLastError());\n"
|
||||||
" /* MFC is a special case: the WinMain is in the MFC library,\n"
|
" /* For MFC apps, WinMain is in the MFC library */\n"
|
||||||
" * instead of the application's library.\n"
|
|
||||||
" */\n"
|
|
||||||
" hMain = hMFC;\n"
|
" hMain = hMFC;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -223,8 +205,6 @@ static const char *wrapper_code =
|
||||||
" /* Cleanup and done */\n"
|
" /* Cleanup and done */\n"
|
||||||
" FreeLibrary(hApp);\n"
|
" FreeLibrary(hApp);\n"
|
||||||
" FreeLibrary(hMFC);\n"
|
" FreeLibrary(hMFC);\n"
|
||||||
" dlclose(appLibrary);\n"
|
|
||||||
" free(libName);\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
" return retcode;\n"
|
" return retcode;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
|
Loading…
Reference in New Issue