View previous topic :: View next topic |
Author |
Message |
arla
Joined: 18 Apr 2005 Posts: 3
|
Posted: Sun May 08, 2005 1:58 pm Post subject: Shared memory |
|
|
I did put this question under "General" some weeks ago, with no respons, so now I try this forum:
I have ported an old application to FTN95 which has a long history over the last 23 years. Starting om UNIVAC 1100, moved to VAX/VMS, Norsk Data, UNIX, Linux, and now finally to WINDOWS/Salford. On all OS it has been simple to create shared memory, so that several processes can share the same data, but on WINDOWS/XP I canīt find out how to do!
Any help out there?
(
arle |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Mon May 09, 2005 2:57 am Post subject: Shared memory |
|
|
Can you be more specific?
How does this work on other operating systems?
For example, is the data shared via common COMMON BLOCKs with some mechanism for communicating the shared base address? |
|
Back to top |
|
|
arla
Joined: 18 Apr 2005 Posts: 3
|
Posted: Mon May 09, 2005 4:44 am Post subject: Shared memory |
|
|
Yes, in some OS the data was placed in common blocks and became shared by commands to the linking process.
In UNIX by using the system calls shmget (get shared memory) and shmat (to attach the shared memory to the data segment). Then several processes can share the data area, but ocause you also need some handshaking when updating the data in this area.
Arne
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue May 10, 2005 3:25 am Post subject: Shared memory |
|
|
The nearest I can get to this situation is to wrap a MODULE around a COMMON BLOCK and to put the module in a DLL. An executable that accesses the DLL can then USE the data in the common block.
There is currently no mechanism for making a COMMON BLOCK (in an executable) "external" so that it can be linked to a common block whose memory is allocated in a DLL (nor for sharing COMMON BLOCKs between DLLs etc).
You might be able to allocate memory for a single array using GET_STORAGE@ (this uses the API function GlobalAlloc which allocates memory from the global heap which all applications share). You could then use the registry (say) to pass this address to another application or DLL. You would then need to pass this address to a SUBROUTINE within which the array is defined. All very complicated I am afraid.
A redesign with one executable and one or more DLLs seems more feasible. |
|
Back to top |
|
|
|