mdbx-windows: rename mdbx_dll_handler() to avoid confusion with callbacks.

Change-Id: I1ee9e9aa46da33f06cf935d3be059f938416efb5
This commit is contained in:
Leonid Yuriev 2019-09-27 11:58:48 +03:00
parent e41369fbc6
commit dcd3c497d9
3 changed files with 12 additions and 11 deletions

View File

@ -299,7 +299,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
add_mdbx_option(MDBX_AVOID_CRT "Avoid dependence from MSVC CRT" ${NOT_SUBPROJECT})
if(NOT BUILD_SHARED_LIBS)
add_mdbx_option(MDBX_CONFIG_MANUAL_TLS_CALLBACK
"Provide mdbx_dll_callback() for manual initialization" OFF)
"Provide mdbx_dll_handler() for manual initialization" OFF)
mark_as_advanced(MDBX_CONFIG_MANUAL_TLS_CALLBACK)
endif()
else()

15
mdbx.h
View File

@ -660,9 +660,9 @@ extern LIBMDBX_API const mdbx_build_info mdbx_build;
* - Modern Windows versions, including Windows Vista and later, provides
* support for "TLS Directory" (e.g .CRT$XL[A-Z] sections in executable
* or dll file). In this case, MDBX capable of doing all automatically,
* and you do not need to call mdbx_dll_callback().
* and you do not need to call mdbx_dll_handler().
* - Obsolete versions of Windows, prior to Windows Vista, REQUIRES calling
* mdbx_dll_callback() manually from corresponding DllMain() or WinMain()
* mdbx_dll_handler() manually from corresponding DllMain() or WinMain()
* of your DLL or application.
* - This behavior is under control of the MODX_CONFIG_MANUAL_TLS_CALLBACK
* option, which is determined by default according to the target version
@ -674,19 +674,19 @@ extern LIBMDBX_API const mdbx_build_info mdbx_build;
#ifndef MDBX_CONFIG_MANUAL_TLS_CALLBACK
#if defined(_WIN32_WINNT_VISTA) && WINVER >= _WIN32_WINNT_VISTA
/* As described above mdbx_dll_callback() is NOT needed forWindows Vista
/* As described above mdbx_dll_handler() is NOT needed forWindows Vista
* and later. */
#define MDBX_CONFIG_MANUAL_TLS_CALLBACK 0
#else
/* As described above mdbx_dll_callback() IS REQUIRED for Windows versions
/* As described above mdbx_dll_handler() IS REQUIRED for Windows versions
* prior to Windows Vista. */
#define MDBX_CONFIG_MANUAL_TLS_CALLBACK 1
#endif
#endif /* MDBX_CONFIG_MANUAL_TLS_CALLBACK */
#if MDBX_CONFIG_MANUAL_TLS_CALLBACK
void LIBMDBX_API NTAPI mdbx_dll_callback(PVOID module, DWORD reason,
PVOID reserved);
void LIBMDBX_API NTAPI mdbx_dll_handler(PVOID module, DWORD reason,
PVOID reserved);
#endif /* MDBX_CONFIG_MANUAL_TLS_CALLBACK */
#endif /* !MDBX_BUILD_SHARED_LIBRARY */
#endif /* Windows */
@ -743,7 +743,8 @@ typedef struct iovec MDBX_val;
/**** DEBUG & LOGGING **********************************************************
* Logging and runtime debug flags.
*
* NOTE: Most of debug feature enabled only if libmdbx builded with MDBX_DEBUG.
* NOTE: Most of debug feature enabled only when libmdbx builded with
* MDBX_DEBUG options.
*/
/* Log level (requires build libmdbx with MDBX_DEBUG) */

View File

@ -43,7 +43,7 @@ BOOL APIENTRY DllMain(HANDLE module, DWORD reason, LPVOID reserved)
static
#endif /* !MDBX_CONFIG_MANUAL_TLS_CALLBACK */
void NTAPI
mdbx_dll_callback(PVOID module, DWORD reason, PVOID reserved)
mdbx_dll_handler(PVOID module, DWORD reason, PVOID reserved)
#endif /* MDBX_BUILD_SHARED_LIBRARY */
{
(void)reserved;
@ -91,7 +91,7 @@ static
# pragma data_seg(".CRT$XLB")
# endif
__declspec(allocate(".CRT$XLB")) PIMAGE_TLS_CALLBACK mdbx_tls_anchor = mdbx_dll_callback;
__declspec(allocate(".CRT$XLB")) PIMAGE_TLS_CALLBACK mdbx_tls_anchor = mdbx_dll_handler;
# pragma data_seg(pop)
# pragma const_seg(pop)
@ -99,7 +99,7 @@ static
# ifdef _WIN64
const
# endif
PIMAGE_TLS_CALLBACK mdbx_tls_anchor __attribute__((__section__(".CRT$XLB"), used)) = mdbx_dll_callback;
PIMAGE_TLS_CALLBACK mdbx_tls_anchor __attribute__((__section__(".CRT$XLB"), used)) = mdbx_dll_handler;
#else
# error FIXME
#endif