
Generally, each application has its own data segment. This mearn they are independent where two applications use a dll together. But, sometimes, we want to know what other applications are doing. So we want used a shared memory. There are many ways to do so, use a shared DLL section is one of them.
Following is the simply step to create a shared memory.
1. Create a DLL project.
2. Create a segment named “.shared”, and create shared members at this section.
#pragma data_seg(".shared")
char theBuffer[1024] = "";
#pragma data_seg()
3. Define this section as shared. This is defined at TheDll.def file.
SECTIONS
.shared READ WRITE SHARED
Senior software engineer with 10 years experience of C/C++ programming. Now also has some project with C#. I'm from Shanghai and now working at Melbourne. At I spare time, I enjoy my family life. My blog,
Childhood is a collection about my family, epically my lovely son. Most of them write in Chinese, and a few in my poor English - please forgive me, I'm improving my English as soon as I can.