🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #9793

Re: Same memory piece for 2 running applications?

#9793
From: Eugene Mayevski [SecureBlackbox]
Date: Tue, 08 Jun 2004 10:52
27 lines
1961 bytes
Ramy wrote:

> Can i allocate an array like this - 
> float array[500][400];
> then write it's address ( &array[0][0] ) and size (500x400) in
> a file, so the other application can read the file and access
> the array by using the pointer and the size from this file?

Yes. In C++ this is done via pragma. The code below is from my global 
hook module.

#pragma data_seg(".GLDATA")
HHOOK hHookK = (HHOOK)0; // Keyboard hook
HHOOK hHookL = (HHOOK)0; // LowLevel hook
#pragma data_seg()

If this doesn't work, you can work with Memory mapping directly. The 
idea is to declare a pointer to an array and when you do 
MapViewOfFile(), set this pointer. Then you will always access the same 
block of memory in both applications.


-- 
Eugene Mayevski
EldoS Corp., CTO
Networking and security solutions, development and consulting services
http://www.eldos.com
Technical Details
Message-ID: <40c59a85$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!62.253.162.219.MISMATCH!newsrout1.ntli.net!news-in.ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40c58d7a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,1b6c238d7724ed66
X-Google-Attributes: gid10cc67,public
Date: Tue, 08 Jun 2004 13:52:20 +0300
From: "Eugene Mayevski [SecureBlackbox]" <mayevski@eldos.org>
Organization: EldoS Corporation
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
X-Accept-Language: en-us, ru, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Same memory piece for 2 running applications? 
References: <40c58d7a$1@newsgroups.borland.com>
In-Reply-To: <40c58d7a$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.159.225.34
Message-ID: <40c59a85$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1086691973 213.159.225.34 (8 Jun 2004 03:52:53 -0700)
Lines: 28
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!62.253.162.219.MISMATCH!newsrout1.ntli.net!news-in.ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail