🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Shared Memory in a DLL (C++Builder 5.0)

#7297
From: Mathieu
Date: Wed, 16 Feb 2005 13:33
42 lines
2368 bytes
"Thomas" <no@mail.com> wrote:
>
>
>
>
>In C++ Builder 6.0 it is possible to create shared data segments in a DLL. I use it for a Windows
>Hook procedure. I have my test software in 2 versions. The first one is made with VC++6.0 and I use 
>the way you described
>
>>A have read that for MSVC++ the right method is to use #pragma like this :
>>#pragma data_seg("SHARED")
>>int MyInt;
>>#pragma data_seg()
>>#pragma comment(linker, "/SECTION:SHARED,RWS")
>
>In C++ Builder 6.0 I use the way you described too:
>
>>Then, I have found that for C++Builder4.0 the right method is to use #pragma like this :
>>#pragma option -zRSHSEG      // change default data segment name
>>#pragma option -zTSHCLASS    // change default data class name
>>int MyInt;
>
>It is important the shared data are in a seperate file. Check out this:
>
>http://bdn.borland.com/article/0,1410,20132,00.html
>
>If you make your DLL with the shared data in the way the technical note shows this you will have your 
>DLL with a shared data segment. I have not check if this way works with BCB5, but it works with BCB4
>and I did it with BCB6.
>
>Regards Thomas

Hi All,

In the first case the compiler give the error "W8094".
In the second case he compiler give the error "E2075", and it's true that I was not able to found any help on the #pragma option -zT / -zR.

Now I use the CreateFileMapping() method and it works fine.

Regards,
Mathieu
Technical Details
Message-ID: <42134ba2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4211f77b@newsgroups.borland.com> <42132e66$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c45e9900a622f92
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mathieu" <captain.spock@enterprise.com>
Sender: "Mathieu" <captain.spock@enterprise.com>
Reply-To: "Mathieu" <captain.spock@enterprise.com>
Subject: Re: Shared Memory in a DLL (C++Builder 5.0)
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 164.129.1.39     
X-Forwarded-For: unknown, unknown
References:  <4211f77b@newsgroups.borland.com> <42132e66$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <42134ba2$1@newsgroups.borland.com>
Date: 16 Feb 2005 05:33:22 -0800
X-Trace: newsgroups.borland.com 1108560802 207.105.83.66 (16 Feb 2005 05:33:22 -0800)
Lines: 45
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail