File tree Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Original file line number Diff line number Diff line change 5
5
* @date January 16, 2024
6
6
* @copyright Copyright (c) 2024
7
7
*/
8
- #if defined(_WIN32 ) || defined(__CYGWIN__ )
9
- #include <windows.h> // `DllMain`
10
- #endif
11
8
12
9
// When enabled, this library will override the symbols usually provided by the C standard library.
13
10
// It's handy if you want to use the `LD_PRELOAD` trick for non-intrusive profiling and replacing
@@ -232,22 +229,8 @@ static void sz_dispatch_table_init(void) {
232
229
}
233
230
234
231
#if defined(_MSC_VER )
235
- BOOL WINAPI DllMain (HINSTANCE hints , DWORD forward_reason , LPVOID lp ) {
236
- switch (forward_reason ) {
237
- case DLL_PROCESS_ATTACH : sz_dispatch_table_init (); return TRUE;
238
- case DLL_THREAD_ATTACH : return TRUE;
239
- case DLL_THREAD_DETACH : return TRUE;
240
- case DLL_PROCESS_DETACH : return TRUE;
241
- }
242
- }
243
-
244
- #if SZ_AVOID_LIBC
245
- BOOL WINAPI _DllMainCRTStartup (HINSTANCE hints , DWORD forward_reason , LPVOID lp ) {
246
- DllMain (hints , forward_reason , lp );
247
- return TRUE;
248
- }
249
- #endif
250
-
232
+ #pragma section(".CRT$XCU", read)
233
+ __declspec(allocate (".CRT$XCU" )) void (* _sz_dispatch_table_init )() = sz_dispatch_table_init ;
251
234
#else
252
235
__attribute__((constructor )) static void sz_dispatch_table_init_on_gcc_or_clang (void ) { sz_dispatch_table_init (); }
253
236
#endif
You can’t perform that action at this time.
0 commit comments