diff --git a/src/prim/prim.c b/src/prim/prim.c index 242cd618..8a2400c8 100644 --- a/src/prim/prim.c +++ b/src/prim/prim.c @@ -45,6 +45,7 @@ terms of the MIT license. A copy of the license can be found in the file } #elif defined(__cplusplus) // C++: use static initialization to detect process start + extern mi_heap_t _mi_heap_main; static bool mi_process_attach(void) { _mi_process_load(); atexit(&_mi_process_done); diff --git a/src/prim/windows/prim.c b/src/prim/windows/prim.c index c62ea497..ed160541 100644 --- a/src/prim/windows/prim.c +++ b/src/prim/windows/prim.c @@ -623,11 +623,11 @@ static void NTAPI mi_win_main(PVOID module, DWORD reason, LPVOID reserved) { #if defined(MI_SHARED_LIB) - #define MI_PRIM_HAS_PROCESS_INIT 1 + #define MI_PRIM_HAS_PROCESS_ATTACH 1 // Windows DLL: easy to hook into process_init and thread_done __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) { - win_main((PVOID)inst,reason,reserved); + mi_win_main((PVOID)inst,reason,reserved); return TRUE; } @@ -639,7 +639,7 @@ static void NTAPI mi_win_main(PVOID module, DWORD reason, LPVOID reserved) { } #elif !defined(MI_WIN_USE_FLS) - #define MI_PRIM_HAS_PROCESS_INIT 1 + #define MI_PRIM_HAS_PROCESS_ATTACH 1 // Set up TLS callbacks in a statically linked library by using special data sections. // See @@ -679,7 +679,7 @@ static void NTAPI mi_win_main(PVOID module, DWORD reason, LPVOID reserved) { #if defined(_MSC_VER) // on clang/gcc use the constructor attribute (in `src/prim/prim.c`) // MSVC: use data section magic for static libraries // See - #define MI_PRIM_HAS_PROCESS_INIT 1 + #define MI_PRIM_HAS_PROCESS_ATTACH 1 static int mi_process_attach(void) { mi_win_main(NULL,DLL_PROCESS_ATTACH,NULL);