Microsoft DirectX 8.1 (C++)

Debugging DirectX Applications

This section covers the following topics pertaining to debugging C and C++ applications.

Debug vs. Retail DLLs

The Microsoft® DirectX® SDK installation program provides the option of installing either debug or retail builds of the DirectX dynamic-link libraries (DLLs).

When you develop software in C++, it is best to install the debug versions of the DLLs. This option installs both debug and retail DLLs on your system. The retail option installs only the retail DLLs. The debug DLLs have additional code that validates internal data structures and output debug error messages, using the Microsoft Win32® OutputDebugString function, while your program is executing. When an error occurs, the debug output gives you a more detailed description of the problem. The debug DLLs execute more slowly than the retail DLLs but are much more useful for debugging an application. Be sure to ship the retail version with your application.

You can use the DirectX Control Panel utility to switch between the debug and retail builds of Microsoft DirectInput®, Direct3D®, and DirectMusic®. To enable this feature, select the debug option when you install the SDK.

To see the debug messages, configure your system so that debug output appears in a window or on a remote computer. A development environment such as Visual Microsoft C++® enables you to do this. Consult the environment documentation for setup instructions.

To ensure that the debugger can find the relevant symbolic information when using debug builds, locate the symbol files as follows:

OS Debugger Location for .pdb file Location for .dbg file
Windows® 95 Windows 98 Visual C++ Same directory as binary Same directory as binary
Windows NT® Windows 2000 Visual C++ Same directory as binary %SystemRoot%\Symbols\<binary extension>\
Windows NT Windows 2000 NTSD/KD %SystemRoot%\Symbols\<binary extension>\ %SystemRoot%\Symbols\<binary extension>\

Note  When debugging with the Visual C++ development system on Microsoft Windows NT/Windows 2000, do not use the WIN32API Splitsym development tool. WIN32API Splitsym copies private symbolic information from the <binary>.dbg file into the symbol directory under the binary extension—for example, %SystemRoot%\Symbols\Dll\—and deletes the original file from the binary directory. Visual C++ relies on finding a private symbolic information (<binary>.dbg) file in the same directory as the binary. Therefore, for debug builds, you must copy the private symbolic information and not delete it. This is an issue only when using Visual C++ with Windows NT/Windows 2000. Consult Visual C++ documentation and Windows 2000 Driver Development Kit (DDK) documentation for further debugging information.