Share via


Understanding Dependencies of a Visual C++ Application

One way to determine what Visual C++ libraries your application depends on is to look at the General Tab in the Property Pages dialog box for your project. You might see, for example, that your project is using the MFC and ATL libraries. If you chose Use MFC in a Dynamic Library, your application at runtime depends on MFC DLLs, such as mfc100.dll. If your application does not use MFC or ATL, it might still depend on the CRT library if you have chosen Multi-Threaded Debug DLL (/MDd) for the Runtime Library on the Code Generation tab in the C/C++ branch of the Configuration Properties.

The most comprehensive way to determine which DLLs your application depends on is to open the application using the Dependency Walker (depends.exe). You can download Dependency Walker from http://www.dependencywalker.com.

By using depends.exe, or the DUMPBIN utility with the /DEPENDENTS option, you can see a list of DLLs that statically link to your application and a list of the application's delay-loaded DLLs.

To see which DLLs, such as ActiveX controls, are dynamically loaded, use the profiling feature of depends.exe. Then, test your application until you are sure that all code paths have been exercised. When you end the profiling session, depends.exe shows which DLLs were dynamically loaded.

When using 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 the target computer and open the application in depends.exe. Depends.exe reports which of the application's DLLs are either missing or present with an incorrect version.

After you have a complete list of DLLs your application depends on, you can determine which of these DLLs you have to redistribute with your application when deploying to another computer. In most cases you do not need 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

Deployment (Visual C++)