Boost logo

Boost Users :

Subject: Re: [Boost-users] Using boost::interprocess shared memory for both 32-bit and 64-bit processes
From: Nat Linden (nat_at_[hidden])
Date: 2010-09-20 21:54:19


On Mon, Sep 20, 2010 at 10:32 AM, Jonathon <thejunkjon_at_[hidden]> wrote:

> I would like to read/write from/to boost::interprocess shared memory
> segments from a 32-bit process and a 64-bit process on the same
> machine.  Is this possible?  I've attempted to do this, but I seem to
> be experiencing some compatibility issues.  Note that I am
> reading/writing boost::interprocess containers to shared memory.
>
> For example, in my 32-bit process, I'll add some data to a
> boost::interprocess::vector and when I read this data from my 64-bit
> process, it returns garbage.  Are there compiler options I can set to
> make things compatible?

I think that to exchange data between different processor
architectures, you can't avoid the need for some sort of data
conversion.

It's tempting to suggest using Boost.Serialization to format your data
into a text archive represented in an interprocess string, then read
it from the other process the same way. But if you're starting down
that path, it strikes me that using an operating-system FIFO instead
of shared memory would be simpler, possibly more robust, and probably
about as fast.


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