Boost logo

Boost Users :

From: Gheury Edmond \(DBB\) (edmond.gheury_at_[hidden])
Date: 2007-04-05 12:53:22


Hello,

I am experiencing some trouble with the boost.serialization library. I'm
using Visual Studio .Net 2003. My serialization code is located inside a
specific DLL (i'm using polymorphic archives). When I want to save the
data, there is no problem. But when I want to load previously saved
data, it throws an "unregistered class" exception.

Thus, I tried the following test: instead of building a DLL, I built the
serialization code into a static ".lib" and relinked my program. Then
everything worked fine.

I tried to track down what threw the exception in the DLL code. I think
the bug consequences show up in extended_type_info.cpp. The ktmap class
is used to register the type keys. When the ktmap::insert is called the
first time, it assigns the address of the static data "instance" to the
m_self class attribute (like singletons). Then, after ktmap::insert has
been called several times, the process enters serialization's load code
and, when ktmap::find is called the first time, it does a check on
m_self, which is NULL. Therefore, it exits without returning anything,
causing a throw in the calling function (basic_iarchive).

When I built the code into a static lib, the ktmap::insert calls occur
like with the DLL code, but when ktmap::find is called, the "m_self"
attribute hasn't been reset to NULL, and the data is loaded
successfully.

I don't know what to do, no warnings are issued when I compile the
serialization DLL so I guess everything is OK on that side. Both the DLL
and the lib are compiled using "multithreaded debug DLL" option in the
code generation tab, which works fine for everything else.

I did some googling and didn't find any thread mentionning that specific
problem. Has anyone suggestions to solve this problem ?

Thank you very much,

Edmond.

--------------------------------------
Dexia Bank disclaimer :
http://www.dexia.be/maildisclaimer.htm
--------------------------------------
   



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