std::ofstream o(case_path_ + "/" + file_name);
if (o.good())
{
// MUST HAVE THIS
boost::serialization::void_cast_register<Derived, Base>(
static_cast<Derived*>(NULL),
static_cast<Base*>(NULL));
boost::archive::polymorphic_text_oarchive oa(o);
boost::archive::polymorphic_oarchive & oa_interface = oa;
oa_interface << base_ptr;
}
Having the void_cast_register() there sort of defeats the purpose though. I shouldn't need to pre-register them.
In all the examples, I see the void_cast_register() inside of the "save" and "load" methods, which is what I have already.
All my serialization code resides in cpp files.
Also, the serialization code resides in a static lib.
But the archive creation and the action to serialize is performed in a dynamic lib.
I am also using polymorphic archives everywhere.
I've also forced template instantiation of all serialization code and polymorphic archive interface stuff.
Any clue?