From: Darren Garvey (darren.garvey_at_[hidden])
Date: 2008-06-15 15:30:41
2008/6/15 Ion Gaztañaga <igaztanaga_at_[hidden]>:
> Darren Garvey wrote:
>> Hello Ion,
>> Title says it all really: the attached mini-program gives me a
>> fault on ubuntu linux 8.04 with gcc 4.2.3 when trying to read back the
>> shared memory between process invocations (trying a similar program on XP
>> also fails).
> The problem is that you are trying to put a type (std::string) that is not
> ready for shared memory or memory mapped files because:
> 1) it surely uses internal raw pointers
> 2) allocates memory from the heap instead of from the shared memory
> That's why Interprocess offers its own containers. See documentation about
> those containers and also try to see some tests where interprocess
> basic_string is being used. That will give you some clues on how to use
> strings in shared memory.
It all works a charm with interprocess::basic_string<>. Great! I didn't
notice that initially - even though I now see it's clearly documented in the
header reference... Perhaps a quick mention of the supported containers from
the "creating vectors/maps in shared memory" section would be helpful?
Anyway, thanks for the pointers (no pun intended).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk