CompuServe Messages

DLL Memory Access

    09-Aug-93 16:59:51
Fm: Chris Doner 76702,776
To: Ted Barbusinski 75460,1403
Ted: DLLs can be used to share data, but your reasoning is sound all the same. The memory situation has changed, and what worked before doesn't work the same way now. By default, a DLL's data is *not* shared among processes. You can, however, change the storage attributes of your data and arrange for certain variables, or even certain dynamic allocations, to be shared among processes. To share variables, you need the data_seg() pragma to assign names to certain sections of your data. Then you need the SECTIONS statement to assign attributes (such as SHARED) to the individually named data sections. For dynamic allocations rather than variables, the solution for shared data is to make the DLL create a shared section object, also called a memory-mapped file, of the necessary size and write the data there. All instances of the DLL can read and write to the same "file". I hope that helps? Brian