Accessing Data Within a DLL

When a DLL dynamically allocates memory, that memory is allocated on behalf of the process that is calling the DLL. This memory is accessible only to threads belonging to this process. This would include memory allocated using GlobalAlloc, LocalAlloc, HeapAlloc, VirtualAlloc, or any of the standard C library routines, such as mallc and new.

If a DLL dynamically allocates memory so that it can be shared among all of the processes currently using the DLL, it should use the file-mapping functions to create named shared memory. For more details on file mapping, see Chapter 17, "I/O with Files."

Global and static variables declared in the DLL's source code exist within the data segment of the DLL. Each process attached ...

Get Microsoft Windows 2000 API SuperBible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.