|
Boost Users : |
From: Avery Fay (btmore_at_[hidden])
Date: 2007-06-28 02:58:59
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 <s.somani_at_[hidden]> wrote:
>
> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net