From 1cb8a99b01858d9b033e6536338e8e6f72f73842 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 7 Jun 2018 13:51:04 +0300 Subject: fixes #1411 (Dev version crashes under XP) --- plugins/Dbx_mdbx/src/init.cpp | 10 +++++++ plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c | 41 +------------------------- 2 files changed, 11 insertions(+), 40 deletions(-) (limited to 'plugins') diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp index 14a4394d2a..3419fd6c78 100644 --- a/plugins/Dbx_mdbx/src/init.cpp +++ b/plugins/Dbx_mdbx/src/init.cpp @@ -49,6 +49,16 @@ CMPlugin::CMPlugin() : ///////////////////////////////////////////////////////////////////////////////////////// +EXTERN_C void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved); + +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved) +{ + tls_callback(hInstDLL, reason, reserved); + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DATABASE, MIID_LAST }; ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c b/plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c index aae7c320c2..feebcab8a8 100644 --- a/plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c +++ b/plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c @@ -27,7 +27,7 @@ /*----------------------------------------------------------------------------*/ /* rthc */ -static void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved) { +void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved) { (void)reserved; switch (reason) { case DLL_PROCESS_ATTACH: @@ -45,45 +45,6 @@ static void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved) { } } -/* *INDENT-OFF* */ -/* clang-format off */ -#if defined(_MSC_VER) -# pragma const_seg(push) -# pragma data_seg(push) - -# ifdef _WIN64 - /* kick a linker to create the TLS directory if not already done */ -# pragma comment(linker, "/INCLUDE:_tls_used") - /* Force some symbol references. */ -# pragma comment(linker, "/INCLUDE:mdbx_tls_callback") - /* specific const-segment for WIN64 */ -# pragma const_seg(".CRT$XLB") - const -# else - /* kick a linker to create the TLS directory if not already done */ -# pragma comment(linker, "/INCLUDE:__tls_used") - /* Force some symbol references. */ -# pragma comment(linker, "/INCLUDE:_mdbx_tls_callback") - /* specific data-segment for WIN32 */ -# pragma data_seg(".CRT$XLB") -# endif - - PIMAGE_TLS_CALLBACK mdbx_tls_callback = tls_callback; -# pragma data_seg(pop) -# pragma const_seg(pop) - -#elif defined(__GNUC__) -# ifdef _WIN64 - const -# endif - PIMAGE_TLS_CALLBACK mdbx_tls_callback __attribute__((section(".CRT$XLB"), used)) - = tls_callback; -#else -# error FIXME -#endif -/* *INDENT-ON* */ -/* clang-format on */ - /*----------------------------------------------------------------------------*/ #define LCK_SHARED 0 -- cgit v1.2.3