Skip to content

Commit

Permalink
Fix: Revert to DllMain includes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Oct 17, 2024
1 parent 169685f commit fb55d54
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions c/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* @date January 16, 2024
* @copyright Copyright (c) 2024
*/
#if defined(_WIN32) || defined(__CYGWIN__)
#include <windows.h> // `DllMain`
#endif

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

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

#else
__attribute__((constructor)) static void sz_dispatch_table_init_on_gcc_or_clang(void) { sz_dispatch_table_init(); }
Expand Down

0 comments on commit fb55d54

Please sign in to comment.