Hi Robert! 

Currently i'm not using the XML-Archive. Did not define DATA_TO_XML, so the text-archive is used.
But the main thing....i found the error. I did not initialize all members. No problem in debug-builds, but deadly for release-builds.

Shall i  remove the explicit datafile.close(); also for text-archives and let the function just return to do correct destruction?

Thank you very much!

2012/5/22 Robert Ramey <ramey@rrsd.com>
Jens Saathoff wrote:
> Hi!
>
>
>
> I'm using boost::serialization to save a structure to a file and read
> from a file. My code works perfect in debug-build, but in
> release-build an exception is thrown. I'm using MSVC2010 to build the
> project on Windows 7 64-Bit-Machine. The code is the same. Who could
> help me out?
>
> You can find the code here: http://boost.codepad.org/8fp6XnC3
>

Hmmm - closing the datafile while the archive class is still open?  Bad
idea.

when an XML archive closes, it has to add some end tags - but in your case
you're closing the archive AFTER the stream has already been closed!

Try


std::wofstream datafile(wxString::Format(_T("%shuddata.prd"),
paths.GetUserLocalDataDir()).ToStdWstring().c_str());
#ifdef DATA_TO_XML
{
  boost::archive::xml_woarchive dataarchive(datafile);
  dataarchive << BOOST_SERIALIZATION_NVP(huddata);
}
#else
{
  boost::archive::text_woarchive dataarchive(datafile);
  dataarchive << BOOST_SERIALIZATION_NVP(huddata);
}
  datafile.close();
#endif

>
> Thank you very much!!!!
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users