Understanding the Dependencies of a Visual C++ Application

To determine which Visual C++ libraries an application depends on, you can view the project properties. (Open the shortcut menu for the project and choose Properties to open the Property Pages dialog box.) You can also use the Dependency Walker (depends.exe), which gives a more comprehensive picture of the dependencies.

In the Property Pages dialog box, you can examine various pages under Configuration Properties to understand the dependencies. For example, if your project uses the MFC libraries and you choose Use of MFC, Use MFC in a Shared DLL on the Configuration Properties, General page, your application at run time depends on MFC DLLs such as mfc100.dll. If your application doesn't use MFC, it might depend on the CRT library if you choose a Runtime Library value of Multi-threaded Debug DLL (/MDd) or Multi-threaded DLL (/MD) on the Configuration Properties, C/C++, Code Generation page.

A more comprehensive way to determine which DLLs your application depends on is to use the Dependency Walker (depends.exe) to open the application. You can download the tool from the Dependency Walker web site.

By using depends.exe, you can examine a list of DLLs that statically link to the application and a list of its delay-loaded DLLs. If you want to get a list of DLLs that are dynamically loaded, you can use the profiling feature in depends.exe to test the application until you're sure that all code paths have been exercised. When you end the profiling session, depends.exe shows which DLLs were dynamically loaded.

When you use depends.exe, be aware that a DLL might have a dependency on another DLL or on a specific version of a DLL. You can use depends.exe on either the development computer or on a target computer. On the development computer, depends.exe reports the DLLs that are required to support an application. If you have trouble getting an application to run on a target computer, you can copy depends.exe to it and then open the application in the tool so that you can determine whether any required DLLs are missing or incorrect.

When you know which DLLs your application depends on, you can determine the ones that you have to redistribute with your application when you deploy it to another computer. In most cases, you don't have to redistribute system DLLs, but you may have to redistribute DLLs for Visual C++ libraries. For more information, see Determining Which DLLs to Redistribute.

See Also

Other Resources

Deploying Native Desktop Applications (Visual C++)