$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [serialization] polymorphic archives + boost_class_exportgenerates linker errors
From: Christoph Heindl (christoph.heindl_at_[hidden])
Date: 2009-11-27 05:33:07
Robert,
> Have your tried runnig the tests/demos included with the package that
> use polymorphic archives? Do they build and run?
I've run all tests and polymorphic examples successfully. This however
does not solve my problem:
My initial linker error was due to the included headers in my previous
example: including <boost/archive/polymorphic_xml_archive.hpp> or any
other concrete polymorphic archive before a call to BOOST_CLASS_EXPORT
fails with the named linker error. I was not aware of the the fact
that including <boost/polymorphic_iarchive.hpp> and
<boost/polymorphic_oarchive.hpp> suffices to enable export for all
polymorphic archives. Maybe this should go into documentation?
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 ]
to the jamfile. I hope it is ok to attach the files directly to this message.
With best regards,
Christoph