Commit bf11cd5084f9c89b6f01bc7c41fddc82745ca14c

Sam Lantinga 2017-01-09T20:37:52

Fixed bug 3552 - Building SDL in release mode fails under VS 2017 RC Lukasz Biel Tried to compile SDL2 using newest version of VS. Got: SDL_audiocvt.obj : error LNK2019: unresolved external symbol memcpy referenced in function SDL_ResampleCVT 1>E:\Users\dotPo\Lib\SDL\VisualC\x64\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals whole compilation process: http://pastebin.com/eWDAvBce Steps to reproduce: clone http://hg.libsdl.org/SDL using tortoise hg, open SDL\VisualC\SDL.sln, when promted if should retarget solution click ok, select release x64 build type, Build/Build Solution attempt 2, using Visual Studio cmake support: open folder SDL\ select release x64 build type, run CMake\Build CMakeLists.txt build fails When switched to debug build type, buils succeeds in both cases. VS 2017 is still beta.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index 3c19a32..88fb1aa 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -378,13 +378,10 @@ SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format
     float *dst = (float *) (cvt->buf + srclen);
     const int dstlen = (cvt->len * cvt->len_mult) - srclen;
     float state[8];
-    int i;
 
     SDL_assert(format == AUDIO_F32SYS);
 
-    for (i = 0; i < chans; i++) {
-        state[i] = src[i];
-    }
+    SDL_memcpy(state, src, chans*sizeof(*src));
 
     cvt->len_cvt = SDL_ResampleAudioSimple(chans, cvt->rate_incr, state, src, srclen, dst, dstlen);