-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Description
When compiling with mongoose.c in a MSVC program in _DEBUG-mode
(with -MDd or -MTd), the strdup() is normally defined to _strdup_dbg() in
Microsoft's crtdbg.h:
#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES
#define strdup(s) _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
...If crtdbg.h gets included after mongoose.h, it's no problem. But vice-versa could be
since src/arch_win32.h and mongoose.h redefines it to _strdup().
This will not work for a _DEBUG program (probably crash).
So I suggest this patch:
--- a/src/arch_win32.h 2021-09-13 15:24:56
+++ b/src/arch_win32.h 2021-09-24 13:27:51
@@ -51,8 +51,10 @@
#ifndef __cplusplus
#define snprintf _snprintf
#define vsnprintf _vsnprintf
+#ifndef strdup
#define strdup(x) _strdup(x)
#endif
+#endif
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels