
Thomas Conway wrote:
Hi all,
I'm trying to use the serialization library for the first time and I'm wondering if there is an extant solution for the problem I'm trying to solve.
I have an application which has dynamicly loaded plugin modules. The application structure is something like:
main app: ---- class base { ... template <class Archive> void serialize(Archive& pAr, unsigned int pVer)
};
plugin: ----
class myPluginN : public base { ... template <class Archive> void serialize(Archive& pAr, unsigned int pVer)
};
In order for this to work, you need to add BOOST_CLASS_EXPORT(myPluginN); to the source of your plugin. In the same source file you need to include headers for several of archive headers. As a result, this derived class will be registered with that archives and you can use those archives in your main applications to load and save instances of the derived class. I'd recomment #including headers for polymorphic_iarchive and polymorphic_oarchive, and using those archive in your application. This will reduce code bloat and make sure your plugins will work with any existing or future archive types (they all can be wrapped in polymorphic_{i,o}archive. - Volodya