Game Crashes Only in Release Mode

Linkman226

#anarchy
Joined
Sep 14, 2007
Messages
2,493
I'm running into an odd problem in my mod, where it only crashes if the game has a release DLL. A debug DLL will cause it to run just fine.

Does anyone have any idea what might cause this?
 
Oh man, these bugs are hard to find. There are a lot of things which are different between the debug and release DLL's, and any one of them can cause this.
The bug is probably there in the debug DLL as well except it doesn't manifest itself as a crash.

Hold on tight, because it ain't gonna be pretty:

Take a look at this. Using that you can debug your optimized release build in VS (it will not be exactly the same as debug DLL, but might have enough info). I know it relates to VS2010, but the info there seems better than that of previous versions.

The C/C++ flags should be added in the makefile to Release_CFLAGS, and the linker flags to Release_LDFLAGS.

You should probably also add this to the linker flags:
Code:
/MAP /MAPINFO:EXPORTS
This will create a map file when the DLL is compiled with a list of functions in the DLL and their memory addresses. That way, even if during the crash you only see a callstack of addresses without symbols (and you can get this even without the flags in the previous link), you can have an idea of where in the code it crashed.

After you rebuild your release DLL with the added flags, run the game from VS (or attach to it), and then when it crashes you should (hopefully) have a better understanding of the problem.
 
That looks like quite the headache. Fortunately I figured out the cause of the crash first- I had forgotten to put a new civ I added into an array that Rhye had created in RFC. Works like a charm now.

Thanks :)
 
Not the slightest clue.

Do DLL's ever do absurd things like this?
In the post month I've had:

1) Compiling gives me errors that are incomprehensible (to me). Building the solution again works just fine. This happened to me several times

2) My mod crashes when I click play scenario, but I can play fine by loading from the World Builder file. I get really frustrated, go play another mod, and come back. Suddenly it works just fine now.
 
Top Bottom