Boost logo

Boost :

Subject: Re: [boost] [serialization] polymorphic archives + boost_class_exportgenerates linker errors
From: Christoph Heindl (christoph.heindl_at_[hidden])
Date: 2009-11-26 05:44:19


I've been able to successfully compile/link/run the demo_polymorphic.
demo_polymorphic, however, uses no boost_class_export. So I've added
it along with a virtual destructor and was still able to run the demo.
But once I've added

#include <boost/archive/xml_iarchive.hpp>

to demo_polymorphic_A.cpp so top of the file becomes

#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/polymorphic_iarchive.hpp>
#include <boost/archive/polymorphic_oarchive.hpp>
#include <boost/serialization/export.hpp>
#include "demo_polymorphic_A.hpp"
BOOST_CLASS_EXPORT(A);

the compiler breaks with "cannot convert parameter 1 from
'boost::archive::xml_iarchive' to
'boost::archive::polymorphic_iarchive &" in
'boost/serialization/access.hpp'

Not the linker error I noticed but probably related to the source of
the problem.

That raises a couple of questions:
 - in my example i use polymorphic archives but still implement the
templated version of serialize. Is that allowed? The reason for doing
so is that I do not have knowledge about the concrete archive type the
user supplies.
 - can a class be exported for polymorphic and non-polymorphic
archives at the same time?

Best regards,
Christoph


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk