Don't define memcpy(), memset() when using static VC runtime. The linker will complain about duplicated symbols otherwise (see #3662, #5156).
diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c
index 9d785aa..62cbef8 100644
--- a/src/stdlib/SDL_stdlib.c
+++ b/src/stdlib/SDL_stdlib.c
@@ -549,8 +549,9 @@ int SDL_isblank(int x) { return ((x) == ' ') || ((x) == '\t'); }
__declspec(selectany) int _fltused = 1;
#endif
-/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls */
-#if _MSC_VER >= 1400
+/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls.
+ Always provide it for the SDL2 DLL, but skip it when building static lib w/ static runtime. */
+#if (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT))
extern void *memcpy(void* dst, const void* src, size_t len);
#pragma intrinsic(memcpy)
@@ -570,7 +571,7 @@ memset(void *dst, int c, size_t len)
{
return SDL_memset(dst, c, len);
}
-#endif /* _MSC_VER >= 1400 */
+#endif /* (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) */
#ifdef _M_IX86