DllMain getting called a lot of times

  • Thread starter Thread starter Abubakar
  • Start date Start date
A

Abubakar

Hi,
I have a dll that gets called by an exe, I just placed a little code in its
dlmain method and put a breakpoint on the code only to discover that its
getting called nearly hundreds of times. I suspect each time some exported
function is getting called the dllmain also gets called. Why is it happening
and why should it happen?

Regards,

...ab
 
Hi,
I have a dll that gets called by an exe, I just placed a little code in
its dlmain method and put a breakpoint on the code only to discover that
its getting called nearly hundreds of times. I suspect each time some
exported function is getting called the dllmain also gets called. Why is
it happening and why should it happen?

The MSDN explains it all:
http://msdn2.microsoft.com/en-us/library/ms682583.aspx

The events are: your dll gets loaded/unloaded and new threads are
created/deleted
 
Cool. Just one thing was odd on the page though, and that was the note up
there that the information in this page is specific to the .net framework
3.0 whereas I think there is nothing on this page related to .net.

Thanks,

...ab
 
Hi,
Cool. Just one thing was odd on the page though, and that was the note up
there that the information in this page is specific to the .net framework
3.0 whereas I think there is nothing on this page related to .net.

Yes, that is truely not helpful. Seems the redesign of MSDN has introduced
some bogus information when it comes to Win32 APIs which really don't care
about the installed .net framework.
 
Back
Top