🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#7288
From: Mathieu
Date: Tue, 15 Feb 2005 13:22
26 lines
1709 bytes
Hi,

Does anybody know how to share memory in a DLL with C++Builder 5.0 ?

I need to shared datas inside a DLL called by two differents EXE.

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")

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;

But the two methods don't work in C++Builder 5.0.

Another point is that it is not possible to use an exported static variable with __declspec(dllexport).

Thank you in advance for your help !

Regards,
Mathieu
Technical Details
Message-ID: <4211f77b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!ltu.se!luth.se!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c45e9900a622f92,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mathieu" <kirck@enterprise.com>
Sender: "Mathieu" <kirck@enterprise.com>
Reply-To: "Mathieu" <kirck@enterprise.com>
Subject: 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
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4211f77b@newsgroups.borland.com>
Date: 15 Feb 2005 05:22:03 -0800
X-Trace: newsgroups.borland.com 1108473723 207.105.83.66 (15 Feb 2005 05:22:03 -0800)
Lines: 28
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!ltu.se!luth.se!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail