   Weird thread crashing? [Solved]
  Greetings,I'm writing a resource manager that is able to run in a seperate thread for dynamic loading.  Now, I have the base class named CResource, so I created a CScript class derived from it.  Now, I'd written and tested the script parsing code before, and it worked great, but when I flip the bit that tells it to load in the seperate thread, it throws a memory access violation within the strlen(...) function at this point:moveax,dword ptr [ecx]; read 4 bytesWhich I believe is the actual string pointer (it's NULL).  The odd thing is, it crashes about every 3rd time, and always 1 second into the loading time...  It's frustrating because I'm having a hard time finding the exact line of code that's causing it.I don't understand why this would be happening ONLY when I run the parsing code within another thread WITH critical sections... The code does use lots of STL, does STL use multiple threads or something? Thanks[Edited by - DirectXFreak on December 7, 2005 2:48:48 PM]
  Have you linked with a thread safe version of the STL? In Visual Studio it's under Project Properties->C++->Code generation->Multi threaded/Multi threaded Debug   ;  Well, I had a stroke of luck!I remembered a long time ago reading something about setting the compiler libaries to multithreaded (duh =P), and that cleared up the issue!Lesson Learned: SET THE COMPILER TO USE MULTITHREADED LIBRARIES!Edit:  Good timing load_bitmap_file =P... I saw your post right after making this one... rating++ for the right answer   