We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5334

Summary: Unresolved external symbol memset referenced in function SDL_vsnprintf_REAL
Product: SDL Reporter: Tom Hulton-Harrop <tom.hultonharrop>
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: blocker    
Priority: P2 CC: sezeroz
Version: HG 2.1   
Hardware: x86_64   
OS: Windows 10   

Description Tom Hulton-Harrop 2020-10-31 21:42:48 UTC
Unresolved external symbol memset referenced in function SDL_vsnprintf_REAL when building with Visual Studio 2019 16.7.3

Error comes from SDL_string.c.obj

Also referenced here: https://stackoverflow.com/questions/58288692/cant-build-solution-in-release-mode-for-sdl-library-on-vs-2019/58432245#58432245

And here:

https://developercommunity.visualstudio.com/content/problem/711317/unexpected-implicit-memset-in-release-optimized-bu.html

Fix: Add vcruntime here:

# Libraries for Win32 native and MinGW
list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 shell32)
Comment 1 Tom Hulton-Harrop 2020-10-31 22:01:21 UTC
MSCV Version - MSVC 19.27.29111.0
Comment 2 Ozkan Sezer 2020-10-31 22:08:41 UTC
(In reply to Tom Hulton-Harrop from comment #0)
> Fix: Add vcruntime here:

Wrong thing to do: It is supposed to build and link w/o any MSC runtime.
Maybe we should try a version of the solution suggested in the second
link you referenced, i.e. something like
#pragma function(memset)
void* __cdecl  memset(void* dest, int c, size_t count) {
    SDL_memset(dest, c, count);
}
Comment 3 Tom Hulton-Harrop 2020-10-31 22:57:11 UTC
Okay understood, yes the second point might be a better option, the first just seemed easier/faster if it could be accepted.

Not sure if the other change is potentially risky or not, hopefully there's a unit test to cover it in case :)
Comment 4 Tom Hulton-Harrop 2020-11-08 19:37:49 UTC
I wound up grabbing the latest SDL build (SDL-2.0.13-14202.zip) and this error no longer exists so this bug can most likely be closed.

Sorry for any inconvenience!
Comment 5 Ozkan Sezer 2020-11-08 19:53:15 UTC
(In reply to Tom Hulton-Harrop from comment #4)
> I wound up grabbing the latest SDL build (SDL-2.0.13-14202.zip) and this
> error no longer exists so this bug can most likely be closed.
> 
> Sorry for any inconvenience!

Huh. Missed that this is actually a duplicate of bug #5112,
and is fixed by https://hg.libsdl.org/SDL/rev/d5fe4ad4d29c

Closing.

*** This bug has been marked as a duplicate of bug 5112 ***
Comment 6 Tom Hulton-Harrop 2020-11-09 10:57:01 UTC
Okay great to hear, thanks for the update.