I can't seem to find out why my code is crashing randomly.
I've got 2 projects in VC++ 2005.
One builds a DLL which just exports some functions that take a pointer to a struct and return unsigned int. Right now all they do is print out all the data in the struct to a file.
The other project is a console app that loads the DLL & calls whatever function I want in the DLL. I have a text menu with options to Load/Unload the DLL, and call each function...
Sometimes when I press 'L' to load the DLL it says it fails to load the DLL, but most times it loads fine.
Sometimes when I press a number to call an exported function it will crash (even the catch(...) handlers don't help), but other times the function runs just fine.
Sometimes is crashes the very first time I run a function, and other times I can run the same function 10 times before it crashes.
How the hell do I debug this mess?
What are the most likely causes of this type of random crashing behavior? Stack corruption or something?
EDIT: I also get a bunch of "TestHarness.exe has triggered a breakpoint" messages, but if I break there it just drops me somewhere deep inside the CRT code.