How To Debug a Dynamic-Link Library (DLL) in Windows

Article translations Article translations
Article ID: 85221 - View products that this article applies to.
This article was previously published under Q85221
Expand all | Collapse all


The process of developing a dynamic-link library (DLL) with Visual C++ usually includes debugging. To do so, you must build a debugging version of the DLL and call it from an application. However, it is not necessary to build the debugging version of the calling application or to build the caller with Visual C++. The following five steps demonstrate debugging a DLL. Note that it is not within the scope of this article to provide detailed instructions for building the DLL.
  1. Build the DLL with debugging information.
  2. Specify the fully-qualified path to the calling application. In Visual C++ for Windows and Visual C++ 32-bit Edition version 1.0, choose Debug from the Options menu and enter the information under Calling Program. In Visual C++ 2.x and 5.0, choose Settings from the Project menu; in Visual C++ 4.0, choose Settings from the Build menu. Select the Debug tab, and enter the information under Executable For Debug Session.
  3. Set a breakpoint in the source code of the DLL function to debug. To do this, place the cursor on the line in the source code to contain the breakpoint and press F9.
  4. Choose Restart from the Debug menu. If the calling program does not contain debugging information, a dialog box appears asking you to confirm your choice. Choose OK and the program starts execution.
  5. After you perform the necessary steps to execute the function that contains the breakpoint, execution stops on the specified line of code.


Article ID: 85221 - Last Review: July 15, 2004 - Revision: 3.1
  • The Visual Workbench Integrated Debugger, when used with:
    • Microsoft Visual C++ 1.0 Professional Edition
    • Microsoft Visual C++ 1.5 Professional Edition
    • Microsoft Visual C++ 1.51
    • Microsoft Visual C++ 1.52 Professional Edition
    • Microsoft Visual C++ 1.0 Professional Edition
    • Microsoft Visual C++ 2.0 Professional Edition
    • Microsoft Visual C++ 2.1
    • Microsoft Visual C++ 4.0 Standard Edition
    • Microsoft Visual C++ 5.0 Standard Edition
kbbug kbdebug kbhowto kbhowtomaster kbide KB85221
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from