473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

DllMain getting called a lot of times

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

Jul 13 '07 #1
3 1363
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

--
SvenC

Jul 13 '07 #2
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

"SvenC" <Sv***@community.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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

--
SvenC

Jul 13 '07 #3
Hi,
>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.
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.

--
SvenC

Jul 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michael Roper | last post by:
In Jesse Liberty's "Programming in C#" he says that "...an assembly must have exactly one entry point: DLLMain, WinMain, or Main. DLLMain is the entry point for DLLs..." In the MSDN ".Net...
0
by: Arno Huetter | last post by:
Hi there, I invoke a native DLL function from managed code. This works fine, but it seems that the DLL's DllMain function is never called upon attaching / detaching. Does anyone have an idea why...
1
by: Boris | last post by:
With MFC Extension DLL that exports classes through __declspec(dllexport) DLL_PROCESS_ATTACH/DLL_PROCESS_DETACH 1. Does each a process loads dll only once and unloads dll only once during its...
7
by: Adam | last post by:
I have a managed cpp wrapper. Im using this in a native dll as a static variable. I need to free this library when the dll is done being used. The perfect place to do this is DllMain for...
3
by: Jozsef Bekes | last post by:
Hi All, is there a mechanism just like DllMain in VC6, a function that gets called whenever an assembly gets loaded? Thank you for all answers. Jozsi
9
by: Ulrich Proeller | last post by:
I currently hunting a problem with a MixedMode dll, which used to work well, until the .NET Framework 2.0 is installed on a machine. Since the, the dll fail when loaded stating that there is a...
2
by: Vincent Fatica | last post by:
I can get Explorer to load (via LoadLibrary()) my DLL using VirtualAlloc(), WriteProcessMemory(), and CreateRemoteThread() (a technique discussed here occasionally). But I'd really like to...
1
by: =?Utf-8?B?U2VhbiBDb25uZXJ5?= | last post by:
Hi, Is it possible to define DllMain in a static library for use in dlls? The reason is that I am defining a platform abstraction for being loaded as a shared library and I figured the simplest...
10
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, From MSDN, http://msdn2.microsoft.com/en-us/library/ms682583.aspx parameter fdwReason of DllMain has four values, DLL_PROCESS_ATTACH
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.