Solved

VC++ Debugger DLL Unloaded??

Posted on 2006-07-06
2
462 Views
Last Modified: 2008-03-10
On the output of an application that is running in debug mode.  It will show when the dll's are loading and unloading.  Is this accurate?  When the Output section shows a.dll unloaded.  Is a.dll completely finished unloading.  Is it starting to unload.  If an exception happens and the output says a.dll unloaded is it safe to assume the exception has nothing to do with a.dll since it is 'unloaded'.  

Is any of this accurate.  Or is the debugging output not an accurate measure for when dll's are loaded and unloaded?
0
Comment
Question by:cophi
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 17052749
Yes, that is correct. When the debugger reports a DLL as 'unloaded', it's reference counter (which is increased with 'LoadLibrary()' and decreased with 'FreeLibrary()') has dropped to zero and the DLL is unmapped from the process' memory.

Yet the exception might have to do with some code in the process trying to access code or data in the DLL that has previously been unloaded.

BTW, you might want to double-check that with the DependencyWalker (www.dependencywalker.com) in 'Profile Mode'. The log file that it creates is veryuseful in diagnosing faulty behaviour.
0
 
LVL 86

Expert Comment

by:jkr
ID: 17052886
As a side note - these messages are generated based on a 'UNLOAD_DLL_DEBUG_EVENT' that the debugger receives through 'WaitForDebugEvent()', see http://msdn.microsoft.com/library/en-us/debug/base/debug_event_str.asp ("DEBUG_EVENT") and http://msdn.microsoft.com/library/en-us/debug/base/unload_dll_debug_info_str.asp ("UNLOAD_DLL_DEBUG_INFO").
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question