Solved

VC++ Debugger DLL Unloaded??

Posted on 2006-07-06
2
457 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now