Re: Critical section shared betwen dll and main program
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Mon, 7 Jan 2008 17:26:59 -0600
"Volodymyr Shcherbyna" <v_scherbina@xxxxxxxxxxxxxxx> wrote in message
news:eunYTAUUIHA.5496@xxxxxxxxxxxxxxxxxxxxxxx
Actually, I would not suggest to pass pointer to any structure between
different components like EXE and DLL.
I guess you aren't using Win32 then. Or have you a way to call
InitializeCriticalSection/EnterCriticalSection/LeaveCriticalSection without
passing a pointer to the kernel32.dll?
Because there is a theoretical chance of incompatible ABE (Application
Binary Environment) bug. Even taking into account, that CRITICAL_SECTION
was not changed since 9x, there always exists a possibility that it might
change, and the code will have a very hidden and weird bug, when DLL uses
old version of CRITICAL_SECTION and passes a pointer to it which is used
in EXE, which was compiled in a newer environment, with another
CRITICAL_SECTION. This of course is a weird situation, but one should keep
in mind such kind of possibility.
Not a problem, because CRITICAL_SECTION in each module must match the Win32
API definition, in which case they are certainly compatible with each other.
--
VolodymyrNG tips:
http://msmvps.com/blogs/v_scherbina/pages/microsoft-newsgroups-tips.aspx
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message
news:uSXppnyTIHA.5264@xxxxxxxxxxxxxxxxxxxxxxx
"Mandi" <mandi@xxxxxxxxxxxx> wrote in message
news:%23nauFfyTIHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
I use critical section in my dll. Now I want to refer to it in my Main
executable?
Is there a way to do it?
There is no problem with passing its address between exe and DLL.
--
Scott McPhillips [VC++ MVP]
.
- Follow-Ups:
- Re: Critical section shared betwen dll and main program
- From: Volodymyr Shcherbyna
- Re: Critical section shared betwen dll and main program
- References:
- Critical section shared betwen dll and main program
- From: Mandi
- Re: Critical section shared betwen dll and main program
- From: Scott McPhillips [MVP]
- Re: Critical section shared betwen dll and main program
- From: Volodymyr Shcherbyna
- Critical section shared betwen dll and main program
- Prev by Date: Re: How to troubleshoot bugchecks on my own?
- Next by Date: Re: How to troubleshoot bugchecks on my own?
- Previous by thread: Re: Critical section shared betwen dll and main program
- Next by thread: Re: Critical section shared betwen dll and main program
- Index(es):
Relevant Pages
|