You can see MSDN docs, like Sharing Files and Memory
Create a shared memory segment
Hello. How can I create a shared memory segment, in Windows ? I ask this because I have found several examples for Linux, but I need it in Windows.
There, I need to write and read char* on a given position ... but I don't know how to accomplish that. Can you help me ?
Windows development Windows API - Win32
Developer technologies C++
2 answers
Sort by: Most helpful
-
-
RLWA32 49,461 Reputation points
2020-10-09T10:57:25.353+00:00 There, I need to write and read char* on a given position
Shared memory using CreateFileMapping and MapViewOfFile is made accessible to a process at a virtual address that is valid in that process. A pointer (e.g., char*) that is stored in shared memory will not be valid when that shared memory is mapped into a different process. And shared memory can be mapped to different virtual addresses in the various process that share it.
Storing data in shared memory doesn't present a problem. However, storing pointers is another thing. A mechanism for using pointers in shared memory is to use Based Pointers which work with offsets.