|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-08-21 13:08:07
Probably something else needs to be explicitly instantiated. Perhaps
template void A::serialize(boost::archive::polymorphic_iarchive& ar,
const unsigned int file_version);
template void A::serialize(boost::archive::polymorphic_oarchive& ar,
const unsigned int file_version);
Look at the demos. One of them addresses this problem - though
not through shared_ptr.
Robert Ramey
Hansi wrote:
> Hello,
>
> I have a problem to serialize a derived class.
> In some classes I use a shared_ptr<A> which acts as a interface for
> some other classes.
>
> Til now I had the implementation in the header and it worked fine
> with the BOOST_CLASS_EXPORT(B)
> declaration after at the end of the header file where B was defined.
>
> For performance reason (compile time) I have moved the serialization
> code from the header file (there is only the declaration) to the .cpp
> file (now I use also only the polymorphic_binary_archive). There I
> have also the declaration for the polymorphic_binary_archive
>
> template void B::serialize(boost::archive::polymorphic_iarchive& ar,
> const unsigned int file_version);
> template void B::serialize(boost::archive::polymorphic_oarchive& ar,
> const unsigned int file_version);
>
> After linking I have now some linker errors. First for the class B
> which is derived from A and for the class A. All linker errors use the
> binary_archive.
>
> If I declare the "BOOST_CLASS_EXPORT(B)" at the end in the .cpp file I
> get only an linker error for class A.
> How I can solve this?
>
> Best regards
> Hansjörg
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net