views:

59

answers:

2

I am using boost serialization with xml files with a C++ program. When I test my program in debug mode, it is working fine. Then I try with the exact same file in release mode, but my program fails when loading the files. I even tried to generate the xml files with my program in release mode, load them back, and it crashes as well.

The call stack shows this:

packs_ui_main.exe!boost::archive::basic_xml_grammar<char>::parse_start_tag(std::basic_istream<char,std::char_traits<char> > & is={...})  Line 219   C++

The actual bug is further but I have no debug information deeper in the call stack. I don't understand what kind of settings could be different between release and debug could explain this crash.

EDIT 1

Here are the preprocessor definitions I use in debug:

WIN32;_CONSOLE;_DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH;_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS

Here are the preprocessor definitions I use in release:

WIN32;NDEBUG;_WINDOWS;_CONSOLE;__WXMSW__;NOPCH;_USE_32BIT_TIME_T;_CRT_SECURE_NO_WARNINGS

Some of them come from wxWidgets

EDIT 2

I have noticed that when I save string in an XML file, they show differently between my release and debug configuraction. It looks as if the release version uses different encoding.

For example "title" shows up as "X�~T" Other characters like spaces totally change the order of the string and insert special characters that I can not copy-paste (probably \0)

I have made sure that both my configurations are using multi byte character set.

+2  A: 

In 100% of my experence, when something succeeds in the debugger, but fails out of the debugger, you've overrun a function local array.

James Curran
+1  A: 

The issue was due to the fact that I was compiling using

Multi-threaded Debug DLL (/MDd)

instead of

Multi-threaded DLL (/MD)

in release mode.

jules