[serialization] polymorphic archives runtime failure (was: polymorphic archives ... generates linker errors)

Hi, thanks to Roberts help I managed to get the polymorphic archives issue, discussed earlier at http://article.gmane.org/gmane.comp.lib.boost.devel/196984), resolved. However there remains a runtime issue I can't resolve: Based on demo_polymorphic.cpp I've re-created minimal test example, which I think is correct, that fails with the runtime assertion it != m_map.end(), file libs\serialization\src\basic_serializer_map.cpp, line 72 on load. The demo consists of 5 files that create the following scenario: class B inherits from polymorphic base class A. An object of B is allocated on the heap and serialized through a base pointer A using a polymorphic xml archive. Saving runs without problems. Next, B is loaded from the stream through a base pointer to A. This fails with the mentioned assertion. What makes me wonder is that changing the from polymorphic_xml_iarchive to xml_iarchive and from polymorphic_xml_oarchive to xml_oarchive will not produce the named assertion. As mentioned in my previous post, I tested this with boost 1.40.0 and msvc 9.0. I would be really, really, grateful if you could give the demo a try. I've prepared everything so that it is just a matter of copying the files to libs/serialization/example and adding [ demo_bsl_run demo_polymorphic_cheind : cheind_a cheind_b ] The files can be found attached to my lost post at http://article.gmane.org/gmane.comp.lib.boost.devel/197061 Best regards, Christoph

Christoph Heindl wrote:
Hi,
try using another archive rather than polymorphic_archive. try using it with xml_archive (if you have name tags) to display the archive. Robert Ramey

On Tue, Dec 1, 2009 at 10:20 PM, Robert Ramey <ramey@rrsd.com> wrote:
try using another archive rather than polymorphic_archive.
Are you suggesting to drop polymorphic archive support?
try using it with xml_archive (if you have name tags) to display the archive.
I did this. The output looks ok. Here it is: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="5"> <a class_id="1" class_name="B" tracking_level="1" version="0" object_id="_0"> <A class_id="0" tracking_level="1" version="0" object_id="_1"> <i>3</i> </A> </a> </boost_serialization> There is no difference in saving using xml_oarchive and polymorphic_xml_oarchive. It fails on loading the type 'B', when using polymorphic_xml_iarchive, which according to the library is an 'unregistered class'. Best regards, Christoph

Christoph Heindl wrote:
On Tue, Dec 1, 2009 at 10:20 PM, Robert Ramey <ramey@rrsd.com> wrote:
try using another archive rather than polymorphic_archive.
Are you suggesting to drop polymorphic archive support?
I'm trying to determine if the problem is specifically with the polymorphic archive.
try using it with xml_archive (if you have name tags) to display the archive.
I did this. The output looks ok. Here it is:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="5"> <a class_id="1" class_name="B" tracking_level="1" version="0" object_id="_0"> <A class_id="0" tracking_level="1" version="0" object_id="_1"> <i>3</i> </A> </a> </boost_serialization>
There is no difference in saving using xml_oarchive and polymorphic_xml_oarchive.
OK - it's got nothtng to do with being a polymorphic archive It fails on loading the type 'B', when using
polymorphic_xml_iarchive, which according to the library is an 'unregistered class'.
Best regards, Christoph _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On Wed, Dec 2, 2009 at 6:07 PM, Robert Ramey <ramey@rrsd.com> wrote:
OK - it's got nothtng to do with being a polymorphic archive
well yes it does: loading using a polymorphic archive fails. loading from a non-polymorphic archive succeeds. Best regards, Christoph
participants (2)
-
Christoph Heindl
-
Robert Ramey