
I've updated the advice on using BOOST_CLASS_EXPORT. The new advice is described in the documentation in the trunk. This will require moving some macros between source modules (*.cpp and *.hpp files). In exchange, you'll get a) a more carefully thought out way to handle exports. b) the ability to include serialization code in DLLS with little or no suprises. c) serialization code will be thread safe - without any locking required. Robert Ramey Dan Thill wrote:
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
#include (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