Added DllMain() to the Windows code.
This commit is contained in:
parent
5094f08994
commit
effb919176
|
@ -1,8 +1,6 @@
|
|||
// 6 april 2015
|
||||
#include "uipriv_windows.h"
|
||||
|
||||
// TODO DllMain()
|
||||
|
||||
HINSTANCE hInstance;
|
||||
int nCmdShow;
|
||||
|
||||
|
@ -66,10 +64,6 @@ const char *uiInit(uiInitOptions *o)
|
|||
|
||||
options = *o;
|
||||
|
||||
hInstance = GetModuleHandle(NULL);
|
||||
if (hInstance == NULL)
|
||||
return loadLastError("getting program HINSTANCE");
|
||||
|
||||
nCmdShow = SW_SHOWDEFAULT;
|
||||
GetStartupInfoW(&si);
|
||||
if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
|
||||
|
@ -112,3 +106,16 @@ void uiFreeInitError(const char *err)
|
|||
{
|
||||
uiFree((void *) err);
|
||||
}
|
||||
|
||||
// TODO consider DisableThreadLibraryCalls() (will require removing ALL C runtime calls)
|
||||
// TODO make sure this is the correct name for C runtime initialization (CHECK MSDN OR THE HEADERS)
|
||||
// TODO can hinstDLL ever change?
|
||||
// TODO handle DLL_PROCESS_DETACH?
|
||||
// TODO __declspec(dllexport)?
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
hInstance = hinstDLL;
|
||||
// TODO provide a cleanup function
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue