diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/library.c | 14 | ||||
-rw-r--r-- | common/library.h | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/common/library.c b/common/library.c index e8547b3..48fd0c9 100644 --- a/common/library.c +++ b/common/library.c @@ -159,11 +159,8 @@ _p11_library_get_thread_local (void) return local; } -#ifdef __GNUC__ -__attribute__((constructor)) -#endif void -p11_library_init (void) +p11_library_init_impl (void) { p11_debug_init (); p11_debug ("initializing library"); @@ -172,6 +169,15 @@ p11_library_init (void) } #ifdef __GNUC__ +__attribute__((constructor)) +#endif +void +p11_library_init (void) +{ + p11_library_init_once (); +} + +#ifdef __GNUC__ __attribute__((destructor)) #endif void diff --git a/common/library.h b/common/library.h index 00e9c2c..f7d5058 100644 --- a/common/library.h +++ b/common/library.h @@ -66,10 +66,12 @@ void p11_message_quiet (void); #define p11_library_init_once() #else /* !OS_WIN32 */ -extern pthread_once_t p11_library_once; +extern pthread_once_t p11_library_once; #define p11_library_init_once() \ - pthread_once (&p11_library_once, p11_library_init); + pthread_once (&p11_library_once, p11_library_init_impl); + +void p11_library_init_impl (void); #endif /* !OS_WIN32 */ |