Re: Critical section shared betwen dll and main program



Actually, I would not suggest to pass pointer to any structure between
different components like EXE and 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.

--
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]


.



Relevant Pages

  • Re: new - delete issue
    ... EXE calls a DLL exported function that return a struct pointer. ... The EXE call another exported function that delete all pointers in that list. ...
    (microsoft.public.vc.mfc)
  • Re: Critical section shared betwen dll and main program
    ... different components like EXE and DLL. ... old version of CRITICAL_SECTION and passes a pointer to it which is used ... There is no problem with passing its address between exe and DLL. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Notify multiple instances of my COM dll to take an action
    ... my dll default interface is derived from IUnknown and the exe ... passing the pointer into the exe but the method call on that pointer ...
    (microsoft.public.vc.atl)
  • Re: System.Environment.GetFolderPath bug?
    ... How can I work arround this bug? ... As Jeff said, Visual studio can be run in WOW64, but it is a 32-bit ... it can only load and run 32bit DLL. ... can only load and run 64bit DLL or EXE. ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Re: Structure containing string across DLL boundary
    ... Exe and DLL both built with static RTL. ... Debug build has no issues. ... The DLL allocates the structure with the embedded string. ... The function in the exe is invoked with a pointer to the structure and then ...
    (microsoft.public.vc.stl)