Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.thread] Exception handling strategy ?
From: Richard Ulrich (richi_at_[hidden])
Date: 2010-08-13 16:32:50

Anybody know what's the status on the portable binary archive?
I just got the "critical error: basic_string::resize" when trying to
open a binary file on amd64 that was saved on intel32.

The same was reported a while back, and it seemed a portable binary
archive was to be included soon. This was with boost 1.34 while I got
this with boost 1.40.


Christian Pfligersdorffer wrote :

>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
>> 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 (
>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.
>Christian Pfligersdorffer
>Software Engineering

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at