
Thanks for your replies. It turns out that you don't need to export the base
class. I've done some experimenting and this is what I've come up with.
Hopefully, this will help someone else.
1.) You can export from a header file, but if you do you can't include that
header more than one time in your program or you get multiple definition
errors. This goes for one export per header as well as all exports in one
header.
2.) Exporting from a source file doesn't work as I posted before. You *have*
to include the iarchive and oarchive headers in your cpp file you're
exporting even if they aren't needed there. Missing one or the other or both
leads to exceptions or plain old crashes.
Unless I'm missing something, the whole export system seems incredibly
fragile.
Avery
On 6/27/07, Sohail Somani
On Wed, 2007-27-06 at 21:10 +0200, Johan Franzén wrote:
Hello Avery,
I suspect You need to BOOST_CLASS_EXPORT(A) as well, since You do try to serialize an A in X's serialize() method. This is was I ended up doing when serializing a hierarchy of derived classes and a base class. I'm not sure how to do that in Your case, since I had all classes and all BOOST_CLASS_EXPORT macros in a single header file.
HTH, Johan Franzén
I think Johan is right. I've found that the safest way to do polymorphic serialization is export ALL your classes, always in cpp files.
Templates are another story.
:)
Sohail
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users