mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:14:14 +08:00
mdbx-windows: add MDBX_AVOID_CRT.
Change-Id: I08233d777b318037372ec250c754f093b3047c94
This commit is contained in:
parent
06e39e2728
commit
ecf214ca04
@ -99,7 +99,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;%(PreprocessorDefinitions);MDBX_DEBUG=1</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;MDBX_AVOID_CRT;%(PreprocessorDefinitions);MDBX_DEBUG=1</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
@ -122,7 +122,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;MDBX_AVOID_CRT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
@ -162,7 +162,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;MDBX_BUILD_DLL;%(PreprocessorDefinitions);MDBX_DEBUG=1</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;MDBX_AVOID_CRT;%(PreprocessorDefinitions);MDBX_DEBUG=1</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
@ -179,7 +179,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;MDBX_AVOID_CRT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
|
@ -53,7 +53,9 @@ static int ntstatus2errcode(NTSTATUS status) {
|
|||||||
* declare them here. Using these APIs also means we must link to
|
* declare them here. Using these APIs also means we must link to
|
||||||
* ntdll.dll, which is not linked by default in user code. */
|
* ntdll.dll, which is not linked by default in user code. */
|
||||||
#pragma comment(lib, "ntdll.lib")
|
#pragma comment(lib, "ntdll.lib")
|
||||||
|
#ifdef MDBX_AVOID_CRT
|
||||||
#pragma comment(lib, "mdbx_ntdll_extra.lib")
|
#pragma comment(lib, "mdbx_ntdll_extra.lib")
|
||||||
|
#endif
|
||||||
|
|
||||||
extern NTSTATUS NTAPI NtCreateSection(
|
extern NTSTATUS NTAPI NtCreateSection(
|
||||||
OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess,
|
OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess,
|
||||||
|
@ -91,6 +91,7 @@ typedef struct {
|
|||||||
} mdbx_condmutex_t;
|
} mdbx_condmutex_t;
|
||||||
typedef CRITICAL_SECTION mdbx_fastmutex_t;
|
typedef CRITICAL_SECTION mdbx_fastmutex_t;
|
||||||
|
|
||||||
|
#ifdef MDBX_AVOID_CRT
|
||||||
#ifndef mdbx_malloc
|
#ifndef mdbx_malloc
|
||||||
static inline void *mdbx_malloc(size_t bytes) {
|
static inline void *mdbx_malloc(size_t bytes) {
|
||||||
return LocalAlloc(LMEM_FIXED, bytes);
|
return LocalAlloc(LMEM_FIXED, bytes);
|
||||||
@ -112,6 +113,13 @@ static inline void *mdbx_realloc(void *ptr, size_t bytes) {
|
|||||||
#ifndef mdbx_free
|
#ifndef mdbx_free
|
||||||
#define mdbx_free LocalFree
|
#define mdbx_free LocalFree
|
||||||
#endif /* mdbx_free */
|
#endif /* mdbx_free */
|
||||||
|
#else
|
||||||
|
#define mdbx_malloc malloc
|
||||||
|
#define mdbx_calloc calloc
|
||||||
|
#define mdbx_realloc realloc
|
||||||
|
#define mdbx_free free
|
||||||
|
#define mdbx_strdup _strdup
|
||||||
|
#endif /* MDBX_AVOID_CRT */
|
||||||
|
|
||||||
#ifndef snprintf
|
#ifndef snprintf
|
||||||
#define snprintf _snprintf /* ntdll */
|
#define snprintf _snprintf /* ntdll */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user