Boost logo

Boost Users :

From: Pfligersdorffer, Christian (Christian.Pfligersdorffer_at_[hidden])
Date: 2008-07-17 05:22:18


Mathieu Peyréga [mathieu.peyrega_at_[hidden]] wrote:

> I'm wondering if a binary archive generated on a 32 bits
> platform would be readable on a 64 bits one...
> My guess is no... because i am facing an issue i strongly suspect to
> come from there...
>
> Any clues ?
>
> I got a basic_string::resize exception evene before trying to call
> the serialize method... just doing :
>
> std::ifstream fichier(filename.c_str(),std::ios::binary);
> boost::archive::binary_iarchive archive(fichier);
>
> the second line causes the exception...
>
> Now i'm even more sure the issue come from the 32 bits 64 bit point...
> See attached the HEX view of the same object kind serialized
> on a binary archive under a 32 bits and a 64 bits platform... (resp
> Vista and Ubuntu 8.04)
>
> Anything that i can configure to avoid that behaviour ? Any
> work arounds ?

Hello Mathieu,

binary archives are platform dependent by design so your application _must_ fail. Either you use xml or text archives from boost::serialization or you grab one of the portable binary archives that are around. Currently there are two implementations I know of: one to be included in some future version of boost::serialization and one that was written by me. The first you can get from the trunk or the authors website I guess, the latter you can download from the boost vault (http://www.boostpro.com/vault/).

If you're willing to experiment a bit, I'd be happy to provide help in testing my implementation on your platform. It has been tested for different endianness and boost versions 1.33 to 1.34.

Regards,

-- 
Christian Pfligersdorffer
Software Engineering
http://www.eos.info

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