Article View: borland.public.cppbuilder.nativeapi
Article #9802Re: Same memory piece for 2 running applications?
From: Ramy
Date: Tue, 08 Jun 2004 14:43
Date: Tue, 08 Jun 2004 14:43
30 lines
1802 bytes
1802 bytes
Thanks very much.
"Eugene Mayevski [SecureBlackbox]" <mayevski@eldos.org> wrote:
>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:
<40c5d08c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40c58d7a$1@newsgroups.borland.com> <40c59a85$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 From: "Ramy" <Ramy@NoMail.com> Sender: "Ramy" <Ramy@NoMail.com> Reply-To: "Ramy" <Ramy@NoMail.com> Subject: Re: Same memory piece for 2 running applications? Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 62.0.27.152 References: <40c58d7a$1@newsgroups.borland.com> <40c59a85$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <40c5d08c$1@newsgroups.borland.com> Date: 8 Jun 2004 07:43:24 -0700 X-Trace: newsgroups.borland.com 1086705804 207.105.83.66 (8 Jun 2004 07:43:24 -0700) Lines: 31 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail