🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Same memory piece for 2 running applications?

#10819
From: Ramy
Date: Wed, 17 Mar 2004 10:46
27 lines
1679 bytes
Thanks very much Steve!  


"Steve Aletto" <steve_alettoANTI@SPAMhotmail.com> wrote:
>Sure you can. And if I recall correctly, CreateFileMapping can be used
>to allocate and use directly _memory_ instead of files (using
>(HANDLE)0xFFFFFFFF as first parameter). My suggestion is to use a
>struct (let's call it StructSharedData) with all the data you need:
>
>struct StructSharedData
>    {
>    int whatever;
>    } *SD;
>
>HANDLE hSD;
>hSD = CreateFileMapping((HANDLE)0xFFFFFFFF, NULL, PAGE_READWRITE, 0,
>sizeof(*SD), "SD");
>SD = (StructSharedData *)MapViewOfFile(hSD, FILE_MAP_WRITE, 0, 0,
>sizeof(*SD));
>...
>Use SD as needed...
>...
>UnmapViewOfFile(SD);
>CloseHandle(hSD);
>
>Steve.
Technical Details
Message-ID: <40582c8b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4057f989$1@newsgroups.borland.com> <405803a6@newsgroups.borland.com> <40580a64$1@newsgroups.borland.com> <40580ba8$1@newsgroups.borland.com> <40581645$2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,e8102036f7e0120d
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-17 02:55:13 PST
From: "Ramy" <Ramy@none.org>
Sender: "Ramy" <Ramy@none.org>
Reply-To: "Ramy" <Ramy@none.org>
Subject: Re: Same memory piece for 2 running applications?
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 62.0.27.152     
References: <4057f989$1@newsgroups.borland.com> <405803a6@newsgroups.borland.com> <40580a64$1@newsgroups.borland.com> <40580ba8$1@newsgroups.borland.com> <40581645$2@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <40582c8b$1@newsgroups.borland.com>
Date: 17 Mar 2004 02:46:35 -0800
X-Trace: newsgroups.borland.com 1079520395 207.105.83.66 (17 Mar 2004 02:46:35 -0800)
Lines: 28
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail