mirror of https://gitlab.com/rnger/amath
Fix MSVC++ memory allocation
This commit is contained in:
parent
be0fbbf80c
commit
c26bf6b561
|
@ -64,6 +64,7 @@
|
|||
<ClCompile Include="lib\clib\alloccpy.c" />
|
||||
<ClCompile Include="lib\clib\mem.c" />
|
||||
<ClCompile Include="lib\clib\memcpy.c" />
|
||||
<ClCompile Include="lib\clib\memoo.cpp" />
|
||||
<ClCompile Include="lib\clib\memset.c" />
|
||||
<ClCompile Include="lib\clib\strcmp.c" />
|
||||
<ClCompile Include="lib\clib\strlen.c" />
|
||||
|
@ -213,7 +214,7 @@
|
|||
<ProjectGuid>{21BD69A9-7F52-48D9-9846-6943E90A87A9}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>amath</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
|
@ -276,7 +277,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>ANSICONSOLE;WITHTEST;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITHTEST;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>app;lib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -290,7 +291,7 @@
|
|||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>ANSICONSOLE;WITHTEST;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITHTEST;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>app;lib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
|
|
@ -402,6 +402,9 @@
|
|||
<ClCompile Include="lib\real\trunc.c">
|
||||
<Filter>lib\real</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lib\clib\memoo.cpp">
|
||||
<Filter>lib\clib</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="app\lib\aengine.h">
|
||||
|
@ -600,4 +603,4 @@
|
|||
<Filter>lib\real</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -35,11 +35,20 @@ void operator delete (void* ptr) { FreeMemSafe(ptr); }
|
|||
void operator delete[] (void* ptr) { FreeMemSafe(ptr); }
|
||||
#endif
|
||||
|
||||
/* GCC 3+ and Windows */
|
||||
#if (__GNUC__ > 2) || defined (_WIN32)
|
||||
/* GCC 3+ */
|
||||
#if (__GNUC__ > 2)
|
||||
#include <new>
|
||||
void* operator new (size_t size) throw(std::bad_alloc) { return AllocMemSafe(size); }
|
||||
void* operator new[] (size_t size) throw(std::bad_alloc) { return AllocMemSafe(size); }
|
||||
void operator delete (void* ptr) throw() { FreeMemSafe(ptr); }
|
||||
void operator delete[] (void* ptr) throw() { FreeMemSafe(ptr); }
|
||||
#endif
|
||||
|
||||
/* MSVC++ */
|
||||
#if defined (_WIN32)
|
||||
#include <new>
|
||||
void* __CRTDECL operator new (size_t size) { return AllocMemSafe(size); }
|
||||
void* __CRTDECL operator new[] (size_t size) { return AllocMemSafe(size); }
|
||||
void __CRTDECL operator delete (void* ptr) throw() { FreeMemSafe(ptr); }
|
||||
void __CRTDECL operator delete[] (void* ptr) throw() { FreeMemSafe(ptr); }
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue