[Boost-users] [serialization] Implementation in mutliple DLLs

50 views
Skip to first unread message

Guy Premont

unread,
Sep 8, 2010, 9:12:09 AM9/8/10
to boost...@lists.boost.org
Hi,

I've done research on the list and could not find any pointer about my
problem so here it is.

I'm using windows, boost 1.40, and vc9, i am not using polymorphic
archives, and i'm using member function serialization.

In a big project, separated in different modules, I want to spread
serialization also into different DLLs. Typically, i have a base class
Base, implemented in Base.dll and the serialization is in
BasePersistence.dll. The serialization member functions are marked
with ddlexport or dllimport, explicit template instantiation is done
to force inclusion in the dll. So far everything is working.

Now I have a class Derived, derived from Base, implemented in
Derived.dll. If i have only one serialization library that handle all
classes, it works fine, but I want the serialization to be split with
the same module as the implemention. So, I want the serialization of
class Derived to be in DerivedPersistence.dll. It compiles but fails
to link, There are a lot of undefined symbols, most are in
boost::serialization::archive namespace.

Is there a special BOOST_DLL flag to use? It seems like the
DerivedPersistence.dll does not find in BasePersistence.dll the
functions it should find.

Is it at all possible to spread the serialization code into multiple
dependent DLLs? Just having something to hint at a possible solution
would be a big help.

Thanks
Guy


--
Guy Prémont, D.Sc.
Architecte logiciel senior / Senior software architect
CM Labs Simulations Inc. http://www.cm-labs.com/
Tel. 514-267-1166 ext. 237
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Robert Ramey

unread,
Sep 8, 2010, 12:53:21 PM9/8/10
to boost...@lists.boost.org

In recent versions of the library, the whole issue of spreading
serialization implemenation across DLL s has recieved a lot of
attention.

It's a stick subject.

First you should read the latest version of the documentation.
Look at the latest explanation on EXPORT macros.

Second, Look at the demo's and tests in the latest package.
These specifically include cases of having Derived in a separate
DLL than the base class and it's its interface. Examples of
a "plug-in" are shows so that one could write his whole
application around the base class interface and plugin
a derived class implementation (including serialization) at
some subsequent time - without rebuilding the main app!

There are still some pending issues though. The library
code has to ability to detect violations of ODR at runtime
but this has been suppressed because too many applications
have violations. In the future this will be resurrected as
an optional feature.

Robert Ramey

Guy Prémont

unread,
Sep 9, 2010, 10:28:58 AM9/9/10
to boost...@lists.boost.org
Thanks for the inputs.

I did get a bit farther, but I forgot to mention an important fact: i am
using my archive classes, based on the existing boost::archive classes.
Therefore, they also must be exported/imported. I think it is the main issue
that is preventing the linking of the DLLs, because of undefined symbols
notably boost::archive::detail::basic_oserializer and basic_iserializer.

I can see why, because defining an archive class uses a mix of template
classes and standard classes that need to be exported/imported. Some are
implemented in boost_serialization.dll which complicates the issue further.

Guy

Reply all
Reply to author
Forward
0 new messages