|
Boost Users : |
Subject: Re: [Boost-users] Serialization XML on windows and linux
From: QUILLET Jean-Charles (jean-charles.quillet_at_[hidden])
Date: 2010-07-08 12:30:46
-----Message d'origine-----
De : Robert Ramey
QUILLET Jean-Charles wrote:
>> Hi,
>>
>> I've been using the boost serialization for quite a few projects and
>> it works realy well in many different situations. But today I'm
>> facing a problem, I find very difficult to solve. I serialize objects
>> in a XML archive for a project working on linux and windows using
>> boost 1.38. And oddly my files are not compatible between the two
>> plateforms. When I try to deserialize an object saved on a different
>> plateform, the application crashes despite the fact that I catch
>> possible exceptions. When I compare the two files, it seems that I
>> have a difference of class_id
>> Here is a sample of what I have on linux:
>>
>> <m_scene3D class_id="4" tracking_level="0" version="0">
>> <pNode class_id="6" class_name="Group"
>> tracking_level="1" version="0" object_id="_1">
>> <Node class_id="5" tracking_level="1"
>> version="0" object_id="_2"></Node>
>> <noeuds class_id="7"
>> tracking_level="0" version="0">
>> <count>0</count>
>>
>> <item_version>0</item_version>
>> </noeuds>
>> </pNode>
>> .
>> </m_scene3D>
>>
>> And the same object on windows:
>>
>> <m_scene3D class_id="4" tracking_level="0" version="0">
>> <pNode class_id="6" class_name="Group"
>> tracking_level="1" version="0" object_id="_1">
>> <Node class_id="7" tracking_level="1"
>> version="0" object_id="_2"></Node>
>> <noeuds class_id="8"
>> tracking_level="0" version="0">
>> <count>0</count>
>>
>> <item_version>0</item_version>
>> </noeuds>
>> </pNode>
>> .
>> </m_scene3D>
>>
>> In my file on windows, I don't have any object of a class_id="5",
>> weird.
>>
>> Does any one know any reason for this behaviour ?
>> Any idea greatly appreciated.
>>
>This is a new one. They should be absolutely compatible. Let us know when
>you find the source of this.
>Robert Ramey
After a few investigations, it seems that my problem is related to the fact that I'm serializing polymorphic objects through a plugin system. I think the linux version should be the good one as no class_id is missing. It seems that there is something that might solve my problem in boost 1.4* reading this:
http://www.boost.org/doc/libs/1_43_0/libs/serialization/doc/special.html#dlls
I understand that I might have redundant serialization code in my application and in the shared librairies: one version might be called on windows and another one from linux (pure speculation) producing two versions of a serialized object.
Does anyone have any experience with this ? Do I have a way out using boost 1.38 or should I upgrade to a newer version to take advantage of the BOOST_EXPORT_CLASS_IMPLEMENT macro ?
Any idea most welcome,
Jean-Charles
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