
Sharing data between processes
Quote:
> In 16 bit environment, if you define a static variable in a DLL all the
>tasks using this DLL can share this piece of data. In 32 bit environment
>this is no longer true because each process carries a separated instance of
>data of a DLL. But what is the easiest way to share this variable in 32
>bit environment?
Yong,
There is a section in Jeffrey Richter's book "Advanced Windows" about
this.
1. In your main file, add:
#pragma data_seg(".SharedData")
DEFINE ALL YOUR SHARED DATA
#pragma data_seg()
2. In your .DEF file, have the following lines (note that the segment
name you give here should match the one in the application's main
file):
SEGMENTS
.SharedData shared
Dave
----
Address is altered to discourage junk mail.
Remove ".---" for the real address.