15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Share memory question

rincosum@hactl.com.hk
Tuesday, August 20, 1996

Environment:  Win95, VC++ 4.0
     
How to implement share memory between two or more process using MFC?

What I want to do is a process call a function which inside DLL to get some 
data. And then the other process to access the those static data which 
store in the previous DLL. Both processes are running concurrently.
     
Thanks,

Rinco.
RincoSum@hactl.com.hk
     



Mats Mеnhav -- manhav@connectum.skurup.se
Saturday, August 24, 1996

[Mini-digest: 2 responses]

-- [ From: Mats Manhav * EMC.Ver #2.5.02 ] --

You should use something called FileMappings. 
In the help Query search for "shared memory dll". You will get a list of
topics. Read the topic called
"Using shared memory in a dynamic link library". This will tell you all you
need to know about it. If you have further questions or problems with it you
can contact me directly.

Mats
-------- REPLY, Original message follows --------

> Date: Tuesday, 20-Aug-96 05:19 PM
> 
> From: rincosum@hactl.com.hk    \ Internet:    (rincosum@hactl.com.hk)
> To:   MFCList                  \ Internet:    (mfc-l@netcom.com)
> 
> Subject: Share memory question
> 
> Environment:  Win95, VC++ 4.0
>      
> How to implement share memory between two or more process using MFC?
> 
> What I want to do is a process call a function which inside DLL to get
some 
> data. And then the other process to access the those static data which 
> store in the previous DLL. Both processes are running concurrently.
>      
> Thanks,
> 
> Rinco.
> RincoSum@hactl.com.hk
>      
> 

-------- REPLY, End of original message --------


--
==========================================================================
Mats Mеnhav (Mats Manhav for 7-bit people)
email:manhav@connectum.skurup.se   WWW: http://connectum.skurup.se/~manhav
FAX:  (int) 46 (0) 414 243 05      Phone: (int) 46 (0) 414 243 05         
==========================================================================

-----From: Dan Kirby 

There are many ways of sharing data between applications.  You can use a 
memory-mapped file, sockets, OLE, named pipes, etc.  But unlike the 16-bit 
world DLLs get make into separate process spaces so you are know longer 
sharing static members of the DLLs between processes (unless you use shared 
data sections).

-dan



Rajat Singhal -- rajat@corus.com
Monday, August 26, 1996

[Mini-digest: 2 responses]

Hi Rinco!

I have not exactly understood your question but if you are looking for 
sharing data between process here's what you can use:

1: Memory-mapped files [ Use MFC class CMemFile or Win32 SDK call
CreateFileMapping]

	OR 

2: Create a shared data segment as follows:
	In your DLL source file:
	------------------------
	#pragma data_seg("MY_DATA")
	   int nSharedVal;
	#pragma data_seg()

	In your module definition file (.def):
	--------------------------------------
	SECTIONS 
    	.MY_DATA READ WRITE SHARED    ; share initialized variables 

In your DLL source file, also add the following function:

int _declspec(dllexport) GetSharedVal ()
{
	return nSharedVal;	// IMPORTANT: "_SAME_COPY_" of nSharedVal is
				// available to all processes.
				// This means if you increment value of 
				// nSharedVal, it increments globally.
				// By default, copies of values are maintained
				// in WIN32 DLL environment. To share values
				// this special arrangement needs to be done.
}


Now, call GetSharedVal() from your process to access the nSharedVal variable.

You can also read the Online Help on "module definition files".
Hope that helps!

Ciao!
-Ra...


On Tue, 20 Aug 1996 rincosum@hactl.com.hk wrote:
> Environment:  Win95, VC++ 4.0
>      
> How to implement share memory between two or more process using MFC?
> 
> What I want to do is a process call a function which inside DLL to get some 
> data. And then the other process to access the those static data which 
> store in the previous DLL. Both processes are running concurrently.
>      
> Thanks,
> 
> Rinco.
> RincoSum@hactl.com.hk
>      
> 

  ---------------------------------------------------------------------
    Rajat Singhal - The Alley Cat  |   ConnectSoft Ruksun S/W (P) Ltd.
       E-Mail: rajat@corus.com     |   Ph: (+91)-0212-678286/88
       ---------------------------------------------------------
        Check out my home page at : http://www.corus.com/~rajat
            ----------------------------------------------
              DO WHAT U BELIEVE IN, BELIEVE IN WHAT U DO
                --------------------------------------



-----From: Tim Hagemann 

The best method is known as "memory mapped files", which enables you to =
map a amount of (virtual) memory in one or more processes at the same =
time. Please refer to the Win32-SDK manual. I think there's also a =
chapter about IPC.

Tim Hagemann
ifa informationssysteme




S.A.C. Madrid -- sacmad2@ibm.net
Tuesday, August 27, 1996

I developed a shared memory zone based on MFC with Map Files. 
It's a class based on CObject.
My problem is that building a DLL as an MFC extension dosent works with VBasic.
Do you have any idea.
If you have any questin on the Shared memory, just Ask.
Thanks.
Pedro.

>Environment:  Win95, VC++ 4.0
>     
>How to implement share memory between two or more process using MFC?
>
>What I want to do is a process call a function which inside DLL to get some 
>data. And then the other process to access the those static data which 
>store in the previous DLL. Both processes are running concurrently.
>     
>Thanks,
>
>Rinco.
>RincoSum@hactl.com.hk
>     
>
>





| Вернуться в корень Архива |