Fixed bug 4662 - SDL failed to build due to error LNK2019: unresolved external symbol _memset referenced in function _IMA_ADPCM_Decode with MSVC on Windows
authorSam Lantinga <slouken@libsdl.org>
Mon, 10 Jun 2019 08:49:26 -0700
changeset 12814cee49246e1bc
parent 12813 dbc1fc3b74b1
child 12820 8e4a6cf76a8c
Fixed bug 4662 - SDL failed to build due to error LNK2019: unresolved external symbol _memset referenced in function _IMA_ADPCM_Decode with MSVC on Windows

LinGao

We build SDL with Visual studio 2017 compiler on Windows Server 2016, but it failed to build due to error LNK2019: unresolved external symbol _memset referenced in function _IMA_ADPCM_Decode on latest default branch. And we found that it can be first reproduced on a39d8cdf50f4 changeset. Could you please help have a look about this issue? Thanks in advance!
src/audio/SDL_wave.c
     1.1 --- a/src/audio/SDL_wave.c	Mon Jun 10 08:46:20 2019 -0700
     1.2 +++ b/src/audio/SDL_wave.c	Mon Jun 10 08:49:26 2019 -0700
     1.3 @@ -110,7 +110,9 @@
     1.4      const char *fmtstr = "WAVE file: %s, %u Hz, %s, %u bits, %u %s/s";
     1.5      const char *waveformat, *wavechannel, *wavebpsunit = "B";
     1.6      Uint32 wavebps = format->byterate;
     1.7 -    char channelstr[64] = {0};
     1.8 +    char channelstr[64];
     1.9 +
    1.10 +    SDL_zero(channelstr);
    1.11  
    1.12      switch (format->encoding) {
    1.13      case PCM_CODE:
    1.14 @@ -641,10 +643,11 @@
    1.15      int result;
    1.16      size_t bytesleft, outputsize;
    1.17      WaveChunk *chunk = &file->chunk;
    1.18 -    ADPCM_DecoderState state = {0};
    1.19 +    ADPCM_DecoderState state;
    1.20      MS_ADPCM_ChannelState cstate[2];
    1.21  
    1.22 -    SDL_memset(cstate, 0, sizeof(cstate));
    1.23 +    SDL_zero(state);
    1.24 +    SDL_zero(cstate);
    1.25  
    1.26      if (chunk->size != chunk->length) {
    1.27          /* Could not read everything. Recalculate number of sample frames. */