Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2008-05-29 18:39:01


Emil Dotchevski wrote:
> On Thu, May 29, 2008 at 10:20 AM, Robert Ramey <ramey_at_[hidden]> wrote:
>> #include <boost/archive/xml_oarchive.hpp>
>>
>> #include <boost/archive/xml_iarchive.hpp>
>> ....
>>
>> // instanciate the code we want to generate and add tothe library
>> template MyClass::serialize<boost::archive::xml_oarchive>;
>>
>> template MyClass::serialize<boost::archive::xml_iarchive>;
>
> Shouldn't there also be something to register the types and archives
> that are statically linked into the DLL so that serialization of
> shared_ptr<polymorphic_base>, etc. can find them?

This would be necessary for those types - and only those types
which use BOOST_CLASS_EXPORT. In this case
the BOOST_CLASS_EXPORT would go into the *.cpp
module which explicitly instantiates the code for each archive.

>Also, is it possible
> to safely unload a DLL that uses boost::serialization?

Yes - when the DLL is unloaded, the main registration table
is updated accordingly. The only restriction is that you can't
be unloading dlls at the same time you're serializing some
type which requires code in that dll.

Robert Ramey


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