Re: How to point to a global memory block from multiple apps?
From: Jim Mack (jmack_at_mdxi.nospam.com)
Date: 12/29/04
- Next message: Bruno Köller: "Re: limitating clipboard data"
- Previous message: Bruno Köller: "Re: How to point to a global memory block from multiple apps?"
- In reply to: Bruno Köller: "Re: How to point to a global memory block from multiple apps?"
- Next in thread: Schmidt: "Re: How to point to a global memory block from multiple apps?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 29 Dec 2004 06:32:30 -0500
Bruno Köller wrote:
>
> How is MyArr() linked tothe memory mapped file? All I've seen till
> now is that I first have to copy an entire block of data from an
> memory mappoed file to my array memory, then to update array values
> and to copy back the array into the memory mapped file, what would
> mean that I have to run two copy processes. There might be no big
> difference between copying the entire array or only a single element
> of it, but two more copys might cost soem time, I fear.
I'm sure Olaf will give you complete details, but basically what you do
is to create an empty but correctly-sized array of the UDT that you're
using, then substitute the address of the memory mapping for the array's
data pointer. You do this in each entity that needs to access the
memory.
Interestingly, the mapping address may actually be different in each
application, but as long as it's opened by the same name, all arrays
will point to the same data.
You can keep mulitple arrays in a single mapping by allocating one block
and using offsets to adjust the pointers into it, but it's usually
simpler to keep multiple mappings, one per array.
There are cautions with this approach -- the array must stay in scope as
long as the remapping is in effect, you must restore the original data
pointer before destroying or modifying the underlying array structure,
etc.
--
Jim Mack
MicroDexterity Inc
www.microdexterity.com
- Next message: Bruno Köller: "Re: limitating clipboard data"
- Previous message: Bruno Köller: "Re: How to point to a global memory block from multiple apps?"
- In reply to: Bruno Köller: "Re: How to point to a global memory block from multiple apps?"
- Next in thread: Schmidt: "Re: How to point to a global memory block from multiple apps?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|