Boost logo

Boost Users :

From: Wu Yinghui, Freddie (yhwu_at_[hidden])
Date: 2006-06-02 20:40:38


> From:
> "John Spicer" <jspicer_at_[hidden]>
> Date:
> Fri, 2 Jun 2006 16:52:25 -0400
>
> Has anyone had any luck getting a serialized object (created using boost
> binary serialization) between two different platforms? I am currently
> using binary serialization on 32 bit & 64 bit machines without issue.
> However, passing the serialized objects between the two platform types
> fail. The serialized classes themselves support interoperability, and as
> such it appears that the serialization libraries themselves do not. I am
> assuming they are storing some type of meta data along with the payload?
>
> Any thoughts on how to do this and keep with binary serialization?
>
> -- John

Based on my own experience, boost binary archives are _not_ guaranteed
to be portable between different hardware platforms. There are also some
hints in the documentation, though I do not immediately recall where it
is mentioned. (The problem is mostly due to endian mismatch and datatype
size difference, if my memory is right.)

What I did to counter this problem is to write a very simple subclass of
binary archives and handle specifically the endian problem. The datatype
size problem can be handled by serialization only types with specific
size no matter on which platform, e.g. boost::int32_t, etc.

Just 5 cents...

Cheers,

Freddie





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