Skip to content

Commit fb55d54

Browse files
committed
Fix: Revert to DllMain includes
1 parent 169685f commit fb55d54

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

c/lib.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* @date January 16, 2024
66
* @copyright Copyright (c) 2024
77
*/
8+
#if defined(_WIN32) || defined(__CYGWIN__)
9+
#include <windows.h> // `DllMain`
10+
#endif
811

912
// When enabled, this library will override the symbols usually provided by the C standard library.
1013
// It's handy if you want to use the `LD_PRELOAD` trick for non-intrusive profiling and replacing
@@ -232,7 +235,6 @@ static void sz_dispatch_table_init(void) {
232235
#pragma section(".CRT$XCU", read)
233236
__declspec(allocate(".CRT$XCU")) void (*_sz_dispatch_table_init)() = sz_dispatch_table_init;
234237

235-
#if 0 //? Implementing DLL symbol resolution on Windows is a bit tricky, so it's disabled for now
236238
BOOL WINAPI DllMain(HINSTANCE hints, DWORD forward_reason, LPVOID lp) {
237239
switch (forward_reason) {
238240
case DLL_PROCESS_ATTACH:
@@ -244,7 +246,6 @@ BOOL WINAPI DllMain(HINSTANCE hints, DWORD forward_reason, LPVOID lp) {
244246
}
245247
return TRUE;
246248
}
247-
#endif
248249

249250
#else
250251
__attribute__((constructor)) static void sz_dispatch_table_init_on_gcc_or_clang(void) { sz_dispatch_table_init(); }

0 commit comments

Comments
 (0)