diff options
author | Fabian Groffen <grobian@gentoo.org> | 2017-06-07 14:37:27 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2017-06-27 13:10:32 +0200 |
commit | 9dd50249b597109c5956a531e44d46dc344daea5 (patch) | |
tree | e721eceb421bed015c95507c40e97675f8db99f9 /common | |
parent | 20b9df53cf07c0693257f5f01fa1ff945b4cae4a (diff) |
common: always use p11_dl_close wrapper
Solaris doesn't like it when dlclose is referenced using a define,
resulting in a linker error looking for a symbol version. Simply
calling the function in a normal way (instead of storing its address)
solves this linking error.
The error message seen by GNU ld is:
dlclose: invalid version 7 (max 0)
Diffstat (limited to 'common')
-rw-r--r-- | common/compat.c | 17 | ||||
-rw-r--r-- | common/compat.h | 6 |
2 files changed, 13 insertions, 10 deletions
diff --git a/common/compat.c b/common/compat.c index 970e5ed..692e2ca 100644 --- a/common/compat.c +++ b/common/compat.c @@ -278,12 +278,6 @@ p11_dl_error (void) return msg_buf; } -void -p11_dl_close (void *dl) -{ - FreeLibrary (dl); -} - int p11_thread_create (p11_thread_t *thread, p11_thread_routine routine, @@ -861,6 +855,17 @@ strerror_r (int errnum, #endif /* HAVE_STRERROR_R */ +void +p11_dl_close (void *dl) +{ +#ifdef OS_WIN32 + FreeLibrary (dl); +#else + (void) dlclose (dl); +#endif +} + + #ifdef OS_UNIX #include <unistd.h> diff --git a/common/compat.h b/common/compat.h index 15b3106..b021494 100644 --- a/common/compat.h +++ b/common/compat.h @@ -91,6 +91,8 @@ char * mkdtemp (char *template); char * strdup_path_mangle (const char *template); +void p11_dl_close (void * dl); + /* ----------------------------------------------------------------------------- * WIN32 */ @@ -147,8 +149,6 @@ typedef HMODULE dl_module_t; char * p11_dl_error (void); -void p11_dl_close (void * dl); - #define p11_sleep_ms(ms) \ (Sleep (ms)) @@ -206,8 +206,6 @@ typedef void * dl_module_t; #define p11_dl_open(f) \ (dlopen ((f), RTLD_LOCAL | RTLD_NOW)) -#define p11_dl_close \ - dlclose #define p11_dl_symbol(d, s) \ (dlsym ((d), (s))) |