MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / DllMain

Function DllMain

3rd/mimalloc-2.0.9/src/init.c:665–680  ·  view source on GitHub ↗

Windows DLL: easy to hook into process_init and thread_done

Source from the content-addressed store, hash-verified

663#if defined(_WIN32) && defined(MI_SHARED_LIB)
664 // Windows DLL: easy to hook into process_init and thread_done
665 __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
666 MI_UNUSED(reserved);
667 MI_UNUSED(inst);
668 if (reason==DLL_PROCESS_ATTACH) {
669 mi_process_load();
670 }
671 else if (reason==DLL_PROCESS_DETACH) {
672 mi_process_done();
673 }
674 else if (reason==DLL_THREAD_DETACH) {
675 if (!mi_is_redirected()) {
676 mi_thread_done();
677 }
678 }
679 return TRUE;
680 }
681
682#elif defined(_MSC_VER)
683 // MSVC: use data section magic for static libraries

Callers

nothing calls this directly

Calls 4

mi_process_loadFunction · 0.85
mi_process_doneFunction · 0.85
mi_is_redirectedFunction · 0.85
mi_thread_doneFunction · 0.85

Tested by

no test coverage detected