I think there’s some awkardness and non-obvious bludgeoning that needs to happen to get base pointers to serialize for library writing (esp when the derived class is in another dependent library). I was trying to pull apart various parts of the serialization library in order to get this to work in my own code but I gave up.
From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Vivek
Sent: Thursday, February 10, 2011 11:37 PM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [Serialization] Registering containers ofuser-provided types
Robert Ramey wrote:
The rub here is your requirement that it be exported through
a base class pointer.
That's exactly right. The library stores user-defined types and returns them to user code, but doesn't know what those types are ahead of time, hence the need to serialize via base pointers. As it is, the BOOST_EXPORT_* macros require I know the types even before compile time (i.e. at the time of writing the library code)... I basically need a way of registering the type at a point between when I've written the code and when it is compiled (which I guess only comes up as an issue for those writing libraries).
That would be the way to do it. However, someone proposed a solution
to this problem and uploaded it as a track item. I found it intriguing,
But I decided not to implement it to keep the library from getting
any more complicated than it already is. You might want to
paste this proposed enhancement into your own code.
Do you have a ticket number or link for this?