Boost logo

Boost Users :

From: Anders Wang Kristensen (awk_at_[hidden])
Date: 2007-07-06 08:24:25


That solution is really impractical, IMHO.
If this is really the only solution, I would consider the serialization lib
broken wrt to DLLs, and that should be in the docs somewhere.

That's really too bad, since it is such a nice and useful library!

I.e. how would you solve the following, if A and B are unrelated libraries
in seperate DLLs sharing a class X that is serialized as part of serializing
A and B?

//dll A
struct A
{
  X x;
};

//dll B
struct B
{
  X x;
};

Placing the serialization code for both libraries in a third io.dll means
that any program using just one of A or B becomes dependent on both A and B
(since io.dll must link to both A and B). And if you added a struct C { X
x; }; it would be even worse..

-- Anders

-----------------------------------------
"Sohail Somani" <s.somani_at_[hidden]> wrote in message

news:1C1EBEF8DBACDC439D038EA051674EC73EE2A3_at_xbox.financialcad.com...
Ensure that the serialization code is in one DLL by having some function
like:

MyClass *
deserializeMyClass(std::istream & is);

And call that from either dll. Then all the serialization magic is hidden
(and instantiated) in one dll and you don't need to worry about cross-dll
template/static/ARGH!

HTH and good luck!

-----Original Message-----
From: boost-users-bounces_at_[hidden] on behalf of Anders Wang
Kristensen
Sent: Thu 7/5/2007 4:57 PM
To: boost-users_at_[hidden]
Subject: [Boost-users] [serialization] DLL woes

Hi,

I'm trying to serialize a class using two functions located in different
DLLs.

I can serialize fine by calling one function, but when I call the second it
triggers
an assertion in extended_type_info.cpp:

        // make sure that attempt at registration is done only once
        assert(lookup(eti) == m_self->m_map.end());

Apparently the class is registered twice, but how do I avoid that?

-- Anders

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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