View Single Post
Old Oct 1st, 2004, 10:35 PM   #2
Ashcroft
Programmer
 
Join Date: Sep 2004
Posts: 38
Rep Power: 0 Ashcroft is on a distinguished road
The problem is that in most operating systems that memory offset is not absolute, it is relative to the memory of that particular program - the fact that one program can not accidentaly step on another is considered a feature.

How you can use memory from another process will depend on what OS you are using. Some Unixes have a shared memory library where you can export a memory segment and attach to it from other processes (sys V shared memory - check for shmctl man page to see if you have it on your system). You may also want to consider using some form of RPC (named pipes, pipes, threads, doors) to communicate between processes.

There is also the possibility of using 'mmap'. Pretty much any of these require modification of the "server" process to some extent and will require a semaphore or mutex to protect the memory that is shared between processes.
Ashcroft is offline   Reply With Quote