Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-02-11 11:46:04


Note that the native binary format has not pretentions to portability. Its
designed to be the leanest and fastest version.

How is this different from "portable_archive" example included in the
package?

Robert Ramey

Steve Gury wrote:
>> Hi,
>>
>> I'm a user of boost serialization and I've detected a small lack in
>> inter-architecture compatibility.
>>
>> Issue:
>> The C and C++ programming languages have different native storage of
>> standard type depending on the architecture of the operating system.
>> For example: On a Linux 64bits (LP64), a long variable is stored
>> with 8 bytes
>> but on a Windows 32bits (ILP32) that same variable will be stored
>> with 4 bytes.
>> Using boost binary serialization as common format for data exchange
>> between those different systems won't work fine.
>> I've written a small patch to fix this issue.
>>
>> Change:
>> _ Detect if binary serialized data come from a system with different
>> native architecture by reading the header. Even if archive is
>> created with the flag "no_header", the architecture signature is
>> stored. _ Change the way how std::string (char*, and other) are
>> stored. We have to store the string's length as a fixed size type
>> (I've chosen unsigned int)
>> and not size_t (which is an unsigned integer of 64bits on 64bits
>> architecture and of 32bits on 32bits architecture).
>> _ Change the way how long and unsigned long are stored by
>> specializing template function for saving and loading.
>> _ All those changes have been protected by a "#define
>> BOOST_CROSS_ARCHITECTURE_COMPATIBLE"
>>
>> I've compiled and tested this patch, on Windows XP 32bits, Debian
>> Linux 64bits (x86_64), compiled with Visual Studio 2005 ( 8.0) and
>> gcc 4.1
>>
>> Best regards,
>> Steve Gury
>>
>> PS:You can find the patch as attachment.
>>
>
>
>
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk