Click here to Skip to main content
11,931,104 members (69,550 online)
Click here to Skip to main content
Add your own
alternative version


25 bookmarked

Share memory throuth DLL

, 1 May 2006
Rate this:
Please Sign up or sign in to vote.
This discussed how more applications share them memory.
<!-- Article Starts - DO NOT ADD HTML/BODY START TAGS-->

Sample Image - Share_memory_throuth_DLL.jpg


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.





This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Software Developer (Senior)
Australia Australia
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
Ren33320-May-10 13:31
memberRen33320-May-10 13:31 
GeneralMy vote of 1 Pin
cefarix30-Aug-09 13:31
membercefarix30-Aug-09 13:31 
General#pragma... Pin
Amir Dashti29-Dec-08 2:18
memberAmir Dashti29-Dec-08 2:18 
GeneralBAD BAD BAD Pin
The_Myth2-May-06 4:32
memberThe_Myth2-May-06 4:32 
GeneralWhats missing Pin
gri2-May-06 3:04
membergri2-May-06 3:04 
You did not mention the restrictions through shared memory Frown | :( For example you can not allocate new memory for the object in the shared memory.

This also does not work:
 pointer* myobject=NULL;
data_seg( )
myobject = new myobject;

In a data_seg() you always have to initialize variables (even to null), otherwise they are only process-bound.

When using a class in the shared data section this class must not allocate new memory!

Sorry for my bad english Wink | ;)

Goodbye and thanks for the fish!
GeneralRe: Whats missing Pin
Denny Wang2-May-06 14:28
memberDenny Wang2-May-06 14:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 1 May 2006
Article Copyright 2006 by Denny50
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid