Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-03-12 20:26:03

Are you sure this worked before? That would surprise me.

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.

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.

Robert Ramey

Vladimir Prus wrote:
>> Hello,
>> I've have a header file like this:
>> namespace lvk { namespace nm_model { namespace runtime {
>> class IntTraceItem {};
>> }}}
>> BOOST_CLASS_EXPORT(lvk::nm_model::runtime::IntTraceItem);
>> The header is included in two files. It used to work before, but
>> I've just updated to CVS state of the serialization lib, and get:
>> multiple definition of
>> first defined here
>> I attach the testcase. When I run
>> g++ -I ~/Work/boost-rc s1.cpp s2.cpp
>> the first error is about duplicate symbols.
>> Am I doing something wrong or is this a regression?
>> - Volodya
>> _______________________________________________
>> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at