mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 01:04:13 +08:00
mdbx-windows: add MDBX_BUILD_DLL and DllMain().
Change-Id: I715f5ea84fe77923eecbc617c4e994e3e5d44605
This commit is contained in:
parent
c9e3dc373b
commit
777d1db5c9
@ -95,7 +95,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;%(PreprocessorDefinitions);MDBX_DEBUG=1</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;%(PreprocessorDefinitions);MDBX_DEBUG=1</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
@ -111,7 +111,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
@ -140,7 +140,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||||
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;%(PreprocessorDefinitions);MDBX_DEBUG=1</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;%(PreprocessorDefinitions);MDBX_DEBUG=1</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
@ -148,7 +148,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
|
2
mdbx.h
2
mdbx.h
@ -207,6 +207,7 @@ extern LIBMDBX_API const mdbx_version_info mdbx_version;
|
|||||||
extern LIBMDBX_API const mdbx_build_info mdbx_build;
|
extern LIBMDBX_API const mdbx_build_info mdbx_build;
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
#ifndef MDBX_BUILD_DLL
|
||||||
|
|
||||||
/* Dll initialization callback for ability to dynamically load MDBX DLL by
|
/* Dll initialization callback for ability to dynamically load MDBX DLL by
|
||||||
* LoadLibrary() on Windows versions before Windows Vista. This function MUST be
|
* LoadLibrary() on Windows versions before Windows Vista. This function MUST be
|
||||||
@ -222,6 +223,7 @@ extern LIBMDBX_API const mdbx_build_info mdbx_build;
|
|||||||
void LIBMDBX_API NTAPI mdbx_dll_callback(PVOID module, DWORD reason,
|
void LIBMDBX_API NTAPI mdbx_dll_callback(PVOID module, DWORD reason,
|
||||||
PVOID reserved);
|
PVOID reserved);
|
||||||
#endif /* MDBX_CONFIG_MANUAL_TLS_CALLBACK */
|
#endif /* MDBX_CONFIG_MANUAL_TLS_CALLBACK */
|
||||||
|
#endif /* MDBX_BUILD_DLL */
|
||||||
#endif /* Windows */
|
#endif /* Windows */
|
||||||
|
|
||||||
/* The name of the lock file in the DB environment */
|
/* The name of the lock file in the DB environment */
|
||||||
|
@ -26,11 +26,16 @@
|
|||||||
|
|
||||||
static void mdbx_winnt_import(void);
|
static void mdbx_winnt_import(void);
|
||||||
|
|
||||||
|
#ifdef MDBX_BUILD_DLL
|
||||||
|
BOOL APIENTRY DllMain(HANDLE module, DWORD reason, LPVOID reserved)
|
||||||
|
#else
|
||||||
#if !MDBX_CONFIG_MANUAL_TLS_CALLBACK
|
#if !MDBX_CONFIG_MANUAL_TLS_CALLBACK
|
||||||
static
|
static
|
||||||
#endif /* !MDBX_CONFIG_MANUAL_TLS_CALLBACK */
|
#endif /* !MDBX_CONFIG_MANUAL_TLS_CALLBACK */
|
||||||
void NTAPI
|
void NTAPI
|
||||||
mdbx_dll_callback(PVOID module, DWORD reason, PVOID reserved) {
|
mdbx_dll_callback(PVOID module, DWORD reason, PVOID reserved)
|
||||||
|
#endif /* MDBX_BUILD_DLL */
|
||||||
|
{
|
||||||
(void)reserved;
|
(void)reserved;
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
@ -47,9 +52,12 @@ static
|
|||||||
mdbx_rthc_thread_dtor(module);
|
mdbx_rthc_thread_dtor(module);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef MDBX_BUILD_DLL
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !MDBX_CONFIG_MANUAL_TLS_CALLBACK
|
#if !defined(MDBX_BUILD_DLL) && !MDBX_CONFIG_MANUAL_TLS_CALLBACK
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
@ -87,7 +95,7 @@ static
|
|||||||
#endif
|
#endif
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
#endif /* !MDBX_CONFIG_MANUAL_TLS_CALLBACK */
|
#endif /* !defined(MDBX_BUILD_DLL) && !MDBX_CONFIG_MANUAL_TLS_CALLBACK */
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user