Use __attribute__((destructor)) on non windows systems.

atexit in shared libraries is not universally supported.
This commit is contained in:
Armin Novak 2018-04-03 14:04:22 +02:00
parent e0d112d548
commit b260937ca6

View File

@ -78,6 +78,10 @@ static int WLog_ParseLogLevel(LPCSTR level);
static BOOL WLog_ParseFilter(wLogFilter* filter, LPCSTR name); static BOOL WLog_ParseFilter(wLogFilter* filter, LPCSTR name);
static BOOL WLog_ParseFilters(void); static BOOL WLog_ParseFilters(void);
#if !defined(_WIN32)
static void WLog_Uninit_(void) __attribute__((destructor));
#endif
static void WLog_Uninit_(void) static void WLog_Uninit_(void)
{ {
DWORD index; DWORD index;
@ -152,7 +156,9 @@ static BOOL CALLBACK WLog_InitializeRoot(PINIT_ONCE InitOnce, PVOID Parameter, P
if (!WLog_SetLogAppenderType(g_RootLog, logAppenderType)) if (!WLog_SetLogAppenderType(g_RootLog, logAppenderType))
goto fail; goto fail;
#if defined(_WIN32)
atexit(WLog_Uninit_); atexit(WLog_Uninit_);
#endif
return TRUE; return TRUE;
fail: fail:
free(g_RootLog); free(g_RootLog);