Hello,

 

I have moved all serialization code in a separate static library that I called serialization. This, in my case, depends on mpi.

The headers in this static library:

1.       include <boost/serialization/export.hpp>

2.       include the definition of the derived class being serialized

3.       declare a template function serialize() that takes a reference to the derived class being serialized in the boost::serialization namespace

4.       invoke the BOOST_CLASS_EXPORT_KEY(<derivedclass>) macro at the global namespace scope

 

The corresponding source files in this static library:

1.       include the header

2.       define the function template serialize()

3.       explicitly instantiate the serialize() function with all the archives used: mpi::packed_iarchive and mpi::packed_oarchive in the boost::serialization namespace

4.       invoke the BOOST_CLASS_EXPORT_IMPLEMENT(<derivedclass>) macro at the global namespace scope

 

The main program links against this static library, and invokes a mpi function (broadcast) that serializes by the base pointer. The base class is polymorphic. All class derivations are public.

 

Debugging, the code reaches : archive/detail/oserializer.hpp

 

boost::archive::detail::save_pointer_type<boost::mpi::packed_oarchive>::polymorphic::save<baseclass>(boost::mpi::packed_oarchive & ar={...}, baseclass& t={...})  Line 400 + 0x38 bytes

 

where NULL==true_type

 

However, looking at the t argument of save(), it shows that is the correct derived object. But the type T is the base class.

 

What am I missing?

regards,