diff options
-rw-r--r-- | src/dlfcn.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/dlfcn.c b/src/dlfcn.c index c4f410d..86f24df 100644 --- a/src/dlfcn.c +++ b/src/dlfcn.c | |||
@@ -61,6 +61,16 @@ typedef ULONG ULONG_PTR; | |||
61 | #endif | 61 | #endif |
62 | #include "dlfcn.h" | 62 | #include "dlfcn.h" |
63 | 63 | ||
64 | #if defined( _MSC_VER ) && _MSC_VER >= 1300 | ||
65 | /* https://docs.microsoft.com/en-us/cpp/cpp/noinline */ | ||
66 | #define DLFCN_NOINLINE __declspec( noinline ) | ||
67 | #elif defined( __GNUC__ ) && ( ( __GNUC__ > 3 ) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) ) | ||
68 | /* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html */ | ||
69 | #define DLFCN_NOINLINE __attribute__(( noinline )) | ||
70 | #else | ||
71 | #define DLFCN_NOINLINE | ||
72 | #endif | ||
73 | |||
64 | /* Note: | 74 | /* Note: |
65 | * MSDN says these functions are not thread-safe. We make no efforts to have | 75 | * MSDN says these functions are not thread-safe. We make no efforts to have |
66 | * any kind of thread safety. | 76 | * any kind of thread safety. |
@@ -418,7 +428,7 @@ int dlclose( void *handle ) | |||
418 | return (int) ret; | 428 | return (int) ret; |
419 | } | 429 | } |
420 | 430 | ||
421 | __declspec(noinline) /* Needed for _ReturnAddress() */ | 431 | DLFCN_NOINLINE /* Needed for _ReturnAddress() */ |
422 | DLFCN_EXPORT | 432 | DLFCN_EXPORT |
423 | void *dlsym( void *handle, const char *name ) | 433 | void *dlsym( void *handle, const char *name ) |
424 | { | 434 | { |