BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Mathieu
Guest





PostPosted: Wed Feb 16, 2005 11:13 am    Post subject: Re: Shared Memory in a DLL (C++Builder 5.0) Reply with quote




"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote:
Quote:

"Mathieu" <kirck (AT) enterprise (DOT) com> wrote in message
news:4211f77b (AT) newsgroups (DOT) borland.com...

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

BCB does not support shared segments. You need to allocate your own shared
memory manually via the Win32 API CreateFileMapping() and MapViewOfFile()
functions.


Gambit



Great ! it's work !

Thank you.

Regards,
Mathieu



Back to top
Thomas
Guest





PostPosted: Wed Feb 16, 2005 11:28 am    Post subject: Re: Shared Memory in a DLL (C++Builder 5.0) Reply with quote







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

Quote:
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:

Quote:
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

Back to top
Thomas
Guest





PostPosted: Wed Feb 16, 2005 11:31 am    Post subject: Re: Shared Memory in a DLL (C++Builder 5.0) Reply with quote




"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote:
Quote:
BCB does not support shared segments.

That is not correct! Try to make it this way and it works with BCB6 Smile I did it for a Windows Hook procedure...

http://bdn.borland.com/article/0,1410,20132,00.html


Back to top
Mathieu
Guest





PostPosted: Wed Feb 16, 2005 1:33 pm    Post subject: Re: Shared Memory in a DLL (C++Builder 5.0) Reply with quote


"Thomas" <no (AT) mail (DOT) com> wrote:
Quote:




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




Back to top
sales@simplesector.com
Guest





PostPosted: Sat Feb 18, 2006 9:03 pm    Post subject: Re: DCOM & NT services Reply with quote

ProgServed will run any program as a Windows Service and much simpler
to use than srvany. It is worth the $10.99. Go to
www.simplesector.com/ProgServed1_1
Back to top
bogon
Guest





PostPosted: Wed Apr 19, 2006 8:03 pm    Post subject: Re: SHGetFolderPath generates errors in header file Reply with quote

Kris wrote:
Quote:
I managed to solve my problem...
#define NO_WIN32_LEAN_AND_MEAN
#include "shlobj.h"

Didn't work.

Then I went to project options / path & defines / conditional defines
and added NO_WIN32_LEAN_AND_MEAN to it instead of using a #define in
the header file.

This solved the compilation problems.

ok, so my reading's months late but for the sake of search engines
everywhere... From my recollection of past news items, I believe it's
#pragma instead of #define. However, for the life of me, I have *no*
idea what the difference. One of these days, I'll get to that level of
programming. ciao.
----------> signature = 6 lines follows <--------------
Neil Duffee, Joe SysProg, U d'Ottawa, Ottawa, Ont, Canada
telephone:1 613 562 5800 x4585 fax:1 613 562 5161
mailto:NDuffee of uOttawa.ca http:/ /aix1.uottawa.ca/ ~nduffee
"How *do* you plan for something like that?" Guardian Bob, Reboot
"For every action, there is an equal and opposite criticism."
"Systems Programming: Guilty, until proven innocent" John Norgauer 2004
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Apr 19, 2006 9:03 pm    Post subject: Re: SHGetFolderPath generates errors in header file Reply with quote

"bogon" <foo@bar> wrote in message news:44469004 (AT) newsgroups (DOT) borland.com...

Quote:
From my recollection of past news items, I believeit's #pragma instead of
#define.


That is not correct.

Quote:
However, for the life of me, I have *no* idea what the difference.

#pragma issues commands to the preprocessor, such as adding additional
command-line parameters when calling the compiler after processing is
finished.

#define declares a value or macro that the preprocessor uses while
processing the code.


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.