Shared memory (and memory mapped file as they are related) are in fact
"memory":) In you program you treate them as if they are from malloc().
You can cast them to your structure and manipulate them, or even use the
special form of new operator to construct a class instance. In most of the
cases, they are not intended to be used as a portable way to do object
serialization. Normally it works like this:
1. Instantiate a chunk of shared memroy from a memory mapped file.
2. Cast it to a structure or simply treate it as untype bytes.
3. Manipulate the shared memroy.
4. Flush or close it so that the changes are saved.
There is no need to have special read/write as long as the memory file is
used on the same machine(which is typically the case). If you want a
portable object serialization you can try ACE_CDR or boost::serialization.
>
> I have seen the ACE_Shared_Memory.h and ACE_Mem_Map
> but I do NOT see any "read" and "write" methods to
> update the pointer that eventually modifies the mapped
> file.
>
Yong
http://seclib.blogspot.com