Don't define memcpy(), memset() when using static VC runtime.

The linker will complain about duplicated symbols otherwise
(see #3662, #5156).
This commit is contained in:
Frank Richter 2022-05-07 14:52:35 +02:00 committed by Sam Lantinga
parent 8cd908e0b9
commit 0e63b514d5
1 changed files with 4 additions and 3 deletions

View File

@ -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