
I've recently checked in changes to the serialization library to support a) DLLS boost_serialization.dll and boost_wserialization.dll. These are counterparts to libboost* respectively. b) autolink is now supported c) there is a new member function for loading archives - reset_object_address to deal with the issues raised by loading collections. The usage of autolink has created a problem with one of the examples demo_portable_archive which derives from a class whose implementation is implemented in the DLL. MS compilers this needs the keyword __declspec(dllexport) and since some of code is templated on the most derived class - there's a problem with templated code using __declspec(dllexport) while the library code with different template parameters does not. My head started to hurt when I thought about it so I just left it as a failing test for VC compilers. Now to your question. fJOAQUIN LOPEZ MU?Z wrote:
Suppose I'm the user of a class called foo which supports serialization through intrusive methods. So, foo.h will look like:
// foo.h
#include <boost/serialization/access.hpp>
// other, non serialization-related includes
class foo { ... };
Now, a programmer uses foo, but does not take advantage of its serialization capabilities.
// user.cpp #include <foo.h>
// use foo
and a second programmer uses foo *and* serializes it.
//user2.cpp #include <foo.h> #include <boost/archive/text_oarchive.hpp>
// use foo and its serialization capabilities.
So far so good. Boost 1.33 release of Boost.Serialization, if I'm not wrong, will include automatic linking, and here comes the problem: when doing the upgrade to 1.33, user2 will be delighted that he'll no longer need to do the linking stuff by himself;
but user1 will get mysterious "not found" linking errors, or worse yet, he'll have Boost.Serialization automagically bundled into his final executable, when he never explictly dealed with this lib in the program!
I don't believe this is the case. Templated code is not emitted unless explictly invoked. If user2 never serializes anything the then the member serialization template won't be expanded. This view is supported by the fact that if serialization isn't used - then no *_iarchive.hpp file is included so the template argument Archive has no known value so its impossible for the compiler emit the code. Robert Ramey