Boost logo

Boost Users :

Subject: [Boost-users] [serialization] Registering/exporting shared_ptr<T> in a library
From: Martin Weinberg (martin.weinberg_at_[hidden])
Date: 2013-12-28 17:15:44

I have a shared library for derived and base classes. My code passes
instances of derived classes T using boost::shared_ptr<B> to the base
class. This all works as expected.

macros to register both the classes Tand shared_ptr<T> typedefs to all
the classes.

If I attempt to serialize a base class pointer, boost::serialization can
not find the serialize member for the shared_ptr to the derived class.

However, if I don't register the shared_ptr<T> for each derived class T
in the shared library, but instead use BOOST_EXPORT_CLASS(shared_ptr<T>)
in main(), everything works fine.

Is there a workaround so that I don't need
BOOST_EXPORT_CLASS(shared_ptr<T>) in main() for every possible derived

Thanks. I can provide a trivial example that illustrates this issue if
that would help.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at