Windows DLL: easy to hook into process_init and thread_done
| 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 |
nothing calls this directly
no test coverage detected