Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-05-04 15:54:14


Martin Ecker wrote:

> Is there work under way to improve the serialization of
> shared_ptr/weak_ptr? Some kind of generic mechanism to serialize other
> smart pointer types, such as boost::shared_array or boost::intrusive_ptr,
> would be very nice.

Indeed it would. I want to review the implementation of boost::shared_ptr in
light of recent observations. The other ones will have to be done by
someone else. Since you have a need/interest in this, perhaps you would
like to do this and send it too me?

> Our system consists of a number of DLLs and we need boost::serialization
> to be built as DLL as well.
> ...
> I might have missed some
> others.

> Is there work under way to fix this and have working DLL builds of
> boost::serialization (just as there are DLL builds for, say,
> boost::regex)?

I have interest in addressing this. I do believe it is addressable without
too much difficulty but will require some extra care. There also might be
some restrictions on usage - I don't know yet.

> In the documentation I would like to see a remark in the section on Export

> Keys, i.e. the BOOST_CLASS_EXPORT macro, that the export macros must not
> be used in header files, at least not in header files included by multiple

> clients, because they implement global variables that must exist only
> once.

My intention was the BOOST_CLASS_EXPORT be included in the header file. I
believe that new static variables are created only when the header file is
used together with an archive header file. So this multiple instances
problem would be avoided by organizing modules so that the combination of
headers only occurs once. This would mean code modules would be organized
similar to the demo_pimpl example where the implementation of class
serialization (invocations of ar << my_class_instance) are in separate
modules from the headers rather than inline functions. Note that this will
result in smaller and easier to maintain code.

> One thing I also find unfortunate is that the BOOST_CLASS_EXPORT macro has

> to be used at global scope and cannot be used inside namespaces. Is there
> a way to fix this? The same goes for BOOST_SERIALIZATION_SPLIT_FREE.

A number of people have noted this - I haven't yet found a satisfactory fix
for this.

> On MSVC 7.1 serialization of a std::vector<bool> doesn't work with the
> default implementation of the boost::serialization library.

Thanks, I'll look into this.

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk