From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-03-14 11:31:19
Robert Ramey wrote:
> Are you sure this worked before? That would surprise me.
Absolutely. This worked for about half an year ;-)
> The problem is that template that implement the "export" functionality are
> instantiated for each archive type previously "seen" in the header. So
> including the following
> #include <boost/archive/text_oarchive.hpp>
> #include <boost/serialization/export.hpp>
> in multiple modules is going to produce multiple symbols at link time.
Yes, I see -- with the current implementation. Maybe, you changed the
> My suggestion would be to include the archive headers only in the modules
> that actually invoke serialization. And that be only in one module. My
> intention was that each class header contain BOOST_CLASS_EXPORT for its
> classes and the the "main" or other module (see demo_pimpl) that actually
> invoked the serialiation would include the headers for the archive classes
> that are desired. This makes it easy to switch between archive types for
> things like debugging, etc.
This is fragile. If I have two modules, linked in one application, which
both use serialization, then if they both include a single header with
BOOST_CLASS_EXPORT, I'll get link error, right? I don't think it's
realistic to expect that either:
1. Classes are serialized only in one module.
2. No header file is used by more that one module.
In my case, I've moved BOOST_CLASS_EXPORT to an implementation file and it
worked. I am not sure this solution is generally applicable -- one might
want header-only class hierarchy...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk