Boost logo

Boost Users :

Subject: Re: [Boost-users] Memory mapped files
From: Richard Damon (Richard_at_[hidden])
Date: 2019-01-23 11:36:44


On 1/23/19 3:15 AM, Simon Giddings via Boost-users wrote:
> Sorry, but this is a very specific Boost question as we are using the
> Boost memory mapping system.
>
> So, if I understand correctly, you are saying that Boost does / cannot
> garantee compatibility between OS and cpu architecture ?
> This would mean that Boost leverages heavily the underlying OS
> services where available.
> Having said that, other than doing a "memory dump", is it possible to
> get Boost to serialise the data out to disk ?

This is very much a generic language question, not a Boost question.

C++ make NO guarantee that in-memory organization of data structures
will match between different architectures, and there is nothing Boost
can do to make those structures match between architectures.

You can 'serialize' data in a architecture agnostic manner, but in
general, that will be nothing like a memory dump. To be totally general,
you need to dump the values in something like an ASCII representation.
If you can be sure that individual types have the same representation,
you can output that as a string of bytes for the individual types, and
reconstruct the types on reading. Do NOT expect class level object to be
streamed out at the byte level and be restore-able at the byte level, so
it will not be anything like a memory map file that can be just used as is.

-- 
Richard Damon

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