dln.c: refine preprocessor conditions by USE_DLN_DLOPEN and _WIN32

This commit is contained in:
Nobuyoshi Nakada 2021-12-17 00:44:54 +09:00
parent fff058a8d6
commit 06bdb41c45
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
Notes: git 2021-12-17 01:56:26 +09:00

8
dln.c
View File

@ -200,13 +200,11 @@ dln_strerror(char *message, size_t size)
return message; return message;
} }
#define dln_strerror() dln_strerror(message, sizeof message) #define dln_strerror() dln_strerror(message, sizeof message)
#elif ! defined _AIX #elif defined USE_DLN_DLOPEN
static const char * static const char *
dln_strerror(void) dln_strerror(void)
{ {
#ifdef USE_DLN_DLOPEN
return (char*)dlerror(); return (char*)dlerror();
#endif
} }
#endif #endif
@ -305,7 +303,7 @@ dln_load(const char *file)
#if (defined _WIN32 || defined USE_DLN_DLOPEN) && defined RUBY_EXPORT #if (defined _WIN32 || defined USE_DLN_DLOPEN) && defined RUBY_EXPORT
static const char incompatible[] = "incompatible library version"; static const char incompatible[] = "incompatible library version";
#endif #endif
#if !defined(_AIX) && !defined(NeXT) #if defined _WIN32 || defined USE_DLN_DLOPEN
const char *error = 0; const char *error = 0;
#endif #endif
@ -495,7 +493,7 @@ dln_load(const char *file)
#endif #endif
#endif #endif
#if !defined(_AIX) && !defined(NeXT) #if defined(_WIN32) || defined(USE_DLN_DLOPEN)
failed: failed:
dln_loaderror("%s - %s", error, file); dln_loaderror("%s - %s", error, file);
#endif #endif