Boost C++ Libraries: Ticket #456: 1.33RC2: archive_pointer_[o/i]serializer assert problem https://svn.boost.org/trac10/ticket/456 <pre class="wiki">Hello again, FYI .. i read the boost mailing list, so posting anwers there is ok for me ;-) I made some progress after reading "rationale" though some things still give headaches. I have polymorphic class hierarchy which gets serialized thru base ptrs (along with shared_ptr stuff). When using portable_binary_oarchive/iarchive (taken from boost example) an assert() triggers which raises some questions. oserializer.hpp: -------------- snip -------------- // sice true_type is valid, and this only gets made if the // pointer oserializer object has been created, this should never fail bpos_ptr = archive_pointer_oserializer&lt;Archive&gt;::find(* true_type); assert(NULL != bpos_ptr); if(NULL == bpos_ptr) boost::throw_exception( archive_exception(archive_exception::unregistered_class) ); -------------- snip -------------- "should never fail" seems to fail and i dont know why ;-( (long callstack omitted) &gt; test_protocollayers.exe!boost::archive::detail::save_pointer_type&lt;portable_binary_oarchive,xxx::ProtocolHeader const *&gt;::polymorphic&lt;xxx::ProtocolHeader&gt;::save(portable_binary_oarchive &amp; ar={...}, const xxx::ProtocolHeader &amp; t={...}, const boost::archive::detail::basic_pointer_oserializer * bpos_ptr=0x00000000) Line 416 C++ test_protocollayers.exe!boost::archive::detail::save_pointer_type&lt;portable_binary_oarchive,xxx::ProtocolHeader const *&gt;::save&lt;xxx::ProtocolHeader&gt;(portable_binary_oarchive &amp; ar={...}, const xxx::ProtocolHeader &amp; t={...}, const boost::archive::detail::basic_pointer_oserializer * bpos_ptr=0x00000000) Line 438 + 0x11 C++ test_protocollayers.exe!boost::archive::detail::save_pointer_type&lt;portable_binary_oarchive,xxx::ProtocolHeader const *&gt;::invoke(portable_binary_oarchive &amp; ar={...}, const xxx::ProtocolHeader * const t=0x00680698) Line 466 + 0x11 C++ test_protocollayers.exe!boost::archive::save&lt;portable_binary_oarchive,xxx::ProtocolHeader const *&gt;(portable_binary_oarchive &amp; ar={...}, const xxx::ProtocolHeader * const &amp; t=0x00680698) Line 535 + 0xf C++ The classes usually contain: "template&lt;class Archive&gt; void serialize( Archive &amp; ar, const unsigned int /* version */)" stuff, along with explicit: "boost::serialization::void_cast_register&lt;Derived, Base&gt;(0,0);" in ctors (or it doesnt work). "this_type" = abstract base "true_type" = derived both classes are successfully retrieved via type info (registered class). The "vp = serialization::void_downcast(*true_type, *this_type, &amp;t);" works too (because the void_cast_register). But it doesnt find appropriate basic_pointer_oserializer .... I placed a breakpoint at "basic_serializer_map::insert(const basic_serializer * bs)" to see what types get registered at startup (initterm ctors). There are indeed registrations but some (derived) types are missing. What gives? BTW ... could you make "portable_binary_oarchive" (and iarchive) included in available boost archive types? I find it useful because serialization is used in cross platform protocol stacks (little vs. big endian archs). Is there any chance to reduce binary overhead due to registration data (shared_ptr/type info ... binary size almost doubled due to contained type info in small payloads). Can stringified type info be omitted/shortened (i use hierachial namespaces which blow the length)? Regards, A. Focht </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/456 Trac 1.4.3 nobody Wed, 10 Aug 2005 15:27:42 GMT <link>https://svn.boost.org/trac10/ticket/456#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/456#comment:1</guid> <description> <pre class="wiki">Logged In: NO Hello again, seems i found the problem ... The "failing" classes causing the assert() were missing shared_ptr serialization registration statement in their respective headers (no/missing compile time checks?) : BOOST_SHARED_POINTER_EXPORT_GUID( aaa::bbb::ccc::classname, class_shortcut) For 1.32 i use enhanced version of original boost::serialization shared_ptr macro (which couldnt handle namespaces). Would be nice if some comment could be added to the assert() place to indicate this as possible cause of error. Anyway ... due to missing polymorphic stuff for STL containers (reset_object_address member) i can't really use 1.33 (large code base which uses polymorphic archive interfaces). I guess that stuff takes some time to add/fix and it wont make into 1.33 If you fix that stuff, we you please so kind and post some link to your development snapshot so i can test it? I would then use it as private post-1.33-release patches for my source tree. Thanks in advance. Regards, A. Focht </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Thu, 20 Oct 2005 04:55:30 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/456#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/456#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=396141 polymorphic archives had a problem which I believe is now fixed on 1.33.1 There are indeed registrations but some (derived) types are missing. What gives? I believe all issues of this nature have been fixed and are resolved in verision 1.33.1 could you make "portable_binary_oarchive" (and iarchive) included in available boost archive types? I find it useful because serialization is used in cross platform protocol stacks (little vs. big endian archs). feel free to promote yourself by adding floating/double and uploading to the boost vault. The mailing list contained code ofr implementing portable floats in an elegant way. You might track this down and add it in. The class name (from BOOST_CLASS_EXPORT) is only included once in the archive. If the size of the archive doubled I would look more deeply to find the reason. Check serialization traits. Robert Ramey </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>sf-robot</dc:creator> <pubDate>Fri, 04 Nov 2005 03:20:09 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/456#comment:3 https://svn.boost.org/trac10/ticket/456#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=1312539 This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker). </pre> Ticket