title: SOIL runtime error in Release Mode - Unhandled exception (ntdll.dll)
body: <p>I am trying to load texture into GLuint (unsigned int). I did the following:</p>
  
  <pre><code>material[materialNum].texture = SOIL_load_OGL_texture((fileLocation + "/" + mtlBufferStr).c_str(), SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT);   
  </code></pre>
  
  <p>This code works on debug mode. But on release mode I got run time error on "_file.c" (I did not create it) and the run time error is:</p>
  
  <blockquote>
    <p>Unhandled exception at 0x771A8E19 (ntdll.dll) in Win32.exe: 0xC0000005: Access violation writing location 0x00000014</p>
  </blockquote>
  
  <p>Why this run time error appears only on release mode and how do I solve it? </p>
  
  <p>Edit: I add the full code of the program with the path of the file and without the GLuint. Stiil the same problem:</p>
  
  <pre><code>int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow )
  {
  
  AllocConsole();
  HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
  int hCrt = _open_osfhandle((long) handle_out, _O_TEXT);
  FILE* hf_out = _fdopen(hCrt, "w");
  setvbuf(hf_out, NULL, _IONBF, 1);
  *stdout = *hf_out;
  
  SOIL_load_OGL_texture("models/havoc/tex_0007_1.dds", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT);                         
  }
  </code></pre>