Boost logo

Boost Users :

From: Dan Thill (dgt_at_[hidden])
Date: 2008-04-12 18:25:08


With 1.34, I was using the pattern described by Robert
(http://lists.boost.org/boost-users/2006/01/16293.php) with
non-intrusive serialization. In short, the serialization functions are
merely declared in the header files. They are implemented in the .cpp
file, and then explicitly instantiated for each archive type I'm using.

However, with 1.35, this no longer works. The export macros create an
instance of the guid initializer as follows:

export.hpp:150

BOOST_PP_CAT(boost_serialization_guid_initializer_, __LINE__)

However, this gives me redefinition errors in the following situaion:

ClassA.h
--------
(line 1:) BOOST_CLASS_EXPORT(ClassA);

ClassB.h
--------
(line 1: )BOOST_CLASS_EXPORT(ClassB);

main.cpp

#include <ClassA.h>
#include <ClassB.h>

(create an archive instance and attempt to serialize)

-------------------------------

As you can see, two objects, both named
boost_serialization_guid_initializer_1, will be created, and the
compiler (MSVC80) will give me a redefinition error.

I honestly have no idea what's going on. This is so obvious, it has to
mean that I'm organizing my code in some weird fashion.

Thanks!
Dan


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