summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-06-07 13:51:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-06-07 13:51:04 +0300
commit1cb8a99b01858d9b033e6536338e8e6f72f73842 (patch)
treeceeeed8acb20c1243adeeb7cce4f2be2161b0555
parentd8c387c7d9322c36b92505c459d7b9a4efdaa4b8 (diff)
fixes #1411 (Dev version crashes under XP)
-rw-r--r--plugins/Dbx_mdbx/src/init.cpp10
-rw-r--r--plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c41
2 files changed, 11 insertions, 40 deletions
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