Re: [Boost-bugs] [Boost C++ Libraries] #3747: Serialization code speculate in order of static initialization

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3747: Serialization code speculate in order of static initialization
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-30 15:55:55


#3747: Serialization code speculate in order of static initialization
--------------------------------------------------+-------------------------
  Reporter: Runar Undheim <r.undheim@…> | Owner: ramey
      Type: Bugs | Status: closed
 Milestone: Boost 1.43.0 | Component: serialization
   Version: Boost 1.41.0 | Severity: Showstopper
Resolution: invalid | Keywords: serialization static order
--------------------------------------------------+-------------------------
Changes (by ramey):

  * status: reopened => closed
  * resolution: => invalid

Comment:

 {{{
 #include "SerializationClasses.hpp"

 #if CLASS_EXPORT_IN_MAIN
   BOOST_CLASS_EXPORT(Object)
   BOOST_CLASS_EXPORT(Main)
 #endif

 int _tmain(int argc, _TCHAR* argv[])
 {
   Main
     mainObj;

   std::ofstream ofs("test.txt", std::ios_base::out);

   boost::archive::text_oarchive oa(ofs);

 // write class instance to archive
   oa << mainObj;
         return 0;
 }


 }}}

 if CLASS_EXPORT_IN_MAIN == 0 this code will fail with unregistered class.

 This is correct behavior. Derived pointer types must be either explicitly
 registered with register type OR with ...EXPORT.

 If EXPORT is used, it must be in the same module as the #include
 ...archive.hpp" is included. This will provoke instantiation of code for
 types not explicitly referred to.

 Looks like everything is working as it is designed to work. Take another
 look a the documentation. If it's not clear on this point, feel free to
 suggest improved wording.

 Robert Ramey

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3747#comment:13>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC