diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2024-11-21 01:52:34 +0100 |
---|---|---|
committer | Silvio Traversaro <silvio@traversaro.it> | 2025-05-03 12:30:48 +0200 |
commit | 529de2d3d04a41f869dd4803404cd763b9e8f72c (patch) | |
tree | 5db110f0fdbf2b785c1a73ae07076ff70ba2d412 /src/dlfcn.c | |
parent | 77152633a5d3d151107ce9a7b876747bce83c8d3 (diff) | |
download | dlfcn-win32-fixpatches.tar.gz dlfcn-win32-fixpatches.tar.bz2 dlfcn-win32-fixpatches.zip |
For non-debug DLL builds avoid linking to CRT library as it is not neededfixpatches
Now when dlfcn.c does not call any function from CRT library, it is not
needed to link dlfcn library with some specific CRT library (e.g.
crtdll.dll, msvcrt.dll, msvcr120.dll or api-ms-win-crt-*.dll) and therefore
bound the dlfcn DLL library to specific Visual C++ runtime version.
This makes libdl.dll DLL library CRT-neutral and therefore can be used or
linked into any EXE application using any CRT library of any version,
without any Visual C++ runtime version conflict.
Diffstat (limited to 'src/dlfcn.c')
-rw-r--r-- | src/dlfcn.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dlfcn.c b/src/dlfcn.c index c128579..5ddf1a7 100644 --- a/src/dlfcn.c +++ b/src/dlfcn.c | |||
@@ -955,4 +955,15 @@ BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) | |||
955 | (void) lpvReserved; | 955 | (void) lpvReserved; |
956 | return TRUE; | 956 | return TRUE; |
957 | } | 957 | } |
958 | |||
959 | /* For non-debug DLL builds defines DLL entry point which avoids using CRT library */ | ||
960 | #if !defined( _DEBUG ) | ||
961 | #ifdef __cplusplus | ||
962 | extern "C" | ||
963 | #endif | ||
964 | BOOL WINAPI _DllMainCRTStartup( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) | ||
965 | { | ||
966 | return DllMain( hinstDLL, fdwReason, lpvReserved ); | ||
967 | } | ||
968 | #endif | ||
958 | #endif | 969 | #endif |