
-----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:
<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>
0 </noeuds> </pNode> .And the same object on windows:
<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>
0 </noeuds> </pNode> .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#dll... 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