MSVC: Make the new malloc() wrapper optional

It causes issues with DLL linkage on MSVC (DLLImport/DLLExport) so let's
just disable it for now...
This commit is contained in:
darkstar
2018-10-03 20:42:07 +02:00
parent 96ce38fa64
commit 7c852a8685
3 changed files with 12 additions and 4 deletions

View File

@@ -8,7 +8,7 @@
* *
* Main include file for the application. * Main include file for the application.
* *
* Version: @(#)emu.h 1.0.32 2018/09/23 * Version: @(#)emu.h 1.0.33 2018/10/03
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -198,9 +198,14 @@ extern void set_screen_size_natural(void);
extern const wchar_t *get_string(int id); extern const wchar_t *get_string(int id);
extern uint32_t get_val(const char *str); extern uint32_t get_val(const char *str);
#ifndef USE_STANDARD_MALLOC
extern void *mem_alloc(size_t sz); extern void *mem_alloc(size_t sz);
#define malloc mem_alloc #define malloc mem_alloc
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -8,7 +8,7 @@
* *
* Misc functions that do not fit anywhere else. * Misc functions that do not fit anywhere else.
* *
* Version: @(#)misc.c 1.0.2 2018/09/22 * Version: @(#)misc.c 1.0.3 2018/10/03
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -88,6 +88,7 @@ get_val(const char *str)
return(l); return(l);
} }
#ifndef USE_STANDARD_MALLOC
/* Safe version of malloc(3) that catches NULL returns. */ /* Safe version of malloc(3) that catches NULL returns. */
void * void *
@@ -110,3 +111,5 @@ mem_alloc(size_t sz)
return(ptr); return(ptr);
} }
#endif

View File

@@ -701,7 +701,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;USE_STANDARD_MALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@@ -740,7 +740,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;USE_STANDARD_MALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>