Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-04-05 18:09:43


Serialization problem with DLLsI'm not sure which version of boost you're using but I'll answer anyway.

I believe the problem occurs when a particular type is used in both the
main line executable as well as the DLL.

The issue of dynamic loading of DLLS was not anticipated and a few adjustments
have been made in an attempt to accomodate it. The lastest version of these
changes have been checked into the HEAD. You might look at extended_type_info.hpp
to be found there and compare it with your own.

I think that the most recent checked in version will work but it really hasn't been
subjected to exhaustive testing. So any feedback on this would be helpful.

Robert Ramey
  "Gheury Edmond (DBB)" <edmond.gheury_at_[hidden]> wrote in message news:4F77D5E09922DA4C8DF58D59ED68CFFA9975FE_at_BHBRVEXM039.dbb.int.dexwired.net...
  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 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