Sharing Memory
12-Aug-93 19:31:46
Sb: #51367-Sharing Memory
Fm: Julie Solon [Microsoft] 71075,107
To: Syndesis 76004,1763
John,
> I'm porting an application that relies on a large, in-memory data
> structure. It shared this between several processes within the same
> computer. Only one application touched it at a time. Each could allocate
> or free memory, adding or subtracting from the data structure.
> Is this kind of memory sharing possible under Win32s and WinNT?
It is possible to create shared data sections under Windows NT using the
following statements in your DEF file
SECTION
.bss SHARED READ WRITE
.data SHARED READ WRITE
In addition, both Win32 and Win32s support Memory-mapped Files.
> Even with the recommended client/server 16/32 intermediate DLLs, is it
possible to pass this data structure back to a straight Win 3.1 app? (Would
a Win 3.1 'huge' pointer be able to walk this extended data structure?)
Currently, under Win32s, 16-bit and 32-bit applications share the same global
data space; therefore, it is possible to share a buffer of up to 64KB with
a far pointer or more than 64KB with a huge pointer by
(1) doing a GlobalAlloc() on the 32-bit side
(2) copying the data
(3) sending the handle to the 16-bit side
(4) getting a pointer to the data on the 16-bit side by using GlobalLock()
The translated pointer is valid until the memory is freed.
One warning: in the future, 16-bit and 32-bit applications may not share the
same global data space. Therefore, the recommendation is to use a buffer that
is passed to UTRegister().
Sincerely,
Julie Solon
Microsoft Developer Support
Read action !re 51818
Enter reply. (/EXIT when done)
1: Thank you! What do you mean exactly by a "memory-ampped mapped file."?
2: /post
Message # 51958 posted