Boost logo

Boost Users :

Subject: Re: [Boost-users] const char* in shared memory object
From: Anthony Foiani (tkil_at_[hidden])
Date: 2012-01-12 22:50:02

Sabine B <sabine565_at_[hidden]> writes:

> I'm a newbie with boost and I'm struggling with objects in shared
> memory. [...]

> Objects of MyType should be shared between processes in shared memory.
> I have no problem to
> put and extract the objects from shared space. But I'm struggling with
> the const char* pointers.

Is there a reason that you are prefering 'const char *' over C++
strings (either std::string or, more to the point,
boost::interprocess::string? The latter are explicitly designed to
live in shared memory, while std::string makes assumptions which break
when shared across different process address spaces.

We just recently had a very closely related thread on this topic; it
might be helpful to you:

I included some working code as well as specific links into the
Boost.Interprocess documentation.

Hope this helps!

Best regards,
Anthony Foiani

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