mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 02:14:12 +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>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<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>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
@ -122,7 +122,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<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>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
@ -162,7 +162,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<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>
|
||||
<StringPooling>true</StringPooling>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
@ -179,7 +179,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<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>
|
||||
<StringPooling>true</StringPooling>
|
||||
<Optimization>Full</Optimization>
|
||||
|
@ -53,7 +53,9 @@ static int ntstatus2errcode(NTSTATUS status) {
|
||||
* declare them here. Using these APIs also means we must link to
|
||||
* ntdll.dll, which is not linked by default in user code. */
|
||||
#pragma comment(lib, "ntdll.lib")
|
||||
#ifdef MDBX_AVOID_CRT
|
||||
#pragma comment(lib, "mdbx_ntdll_extra.lib")
|
||||
#endif
|
||||
|
||||
extern NTSTATUS NTAPI NtCreateSection(
|
||||
OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess,
|
||||
|
@ -91,6 +91,7 @@ typedef struct {
|
||||
} mdbx_condmutex_t;
|
||||
typedef CRITICAL_SECTION mdbx_fastmutex_t;
|
||||
|
||||
#ifdef MDBX_AVOID_CRT
|
||||
#ifndef mdbx_malloc
|
||||
static inline void *mdbx_malloc(size_t bytes) {
|
||||
return LocalAlloc(LMEM_FIXED, bytes);
|
||||
@ -112,6 +113,13 @@ static inline void *mdbx_realloc(void *ptr, size_t bytes) {
|
||||
#ifndef mdbx_free
|
||||
#define mdbx_free LocalFree
|
||||
#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
|
||||
#define snprintf _snprintf /* ntdll */
|
||||
|
Loading…
x
Reference in New Issue
Block a user