Prevent MSVC from optimizing away tls_callback (resolves #318)

This commit is contained in:
rustyx 2016-02-02 11:27:18 +01:00 committed by Jason Evans
parent 7f283980f0
commit efbee86278

View File

@ -148,13 +148,15 @@ _tls_callback(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
#ifdef _MSC_VER #ifdef _MSC_VER
# ifdef _M_IX86 # ifdef _M_IX86
# pragma comment(linker, "/INCLUDE:__tls_used") # pragma comment(linker, "/INCLUDE:__tls_used")
# pragma comment(linker, "/INCLUDE:_tls_callback")
# else # else
# pragma comment(linker, "/INCLUDE:_tls_used") # pragma comment(linker, "/INCLUDE:_tls_used")
# pragma comment(linker, "/INCLUDE:tls_callback")
# endif # endif
# pragma section(".CRT$XLY",long,read) # pragma section(".CRT$XLY",long,read)
#endif #endif
JEMALLOC_SECTION(".CRT$XLY") JEMALLOC_ATTR(used) JEMALLOC_SECTION(".CRT$XLY") JEMALLOC_ATTR(used)
static BOOL (WINAPI *const tls_callback)(HINSTANCE hinstDLL, BOOL (WINAPI *const tls_callback)(HINSTANCE hinstDLL,
DWORD fdwReason, LPVOID lpvReserved) = _tls_callback; DWORD fdwReason, LPVOID lpvReserved) = _tls_callback;
#endif #endif