Determining Which DLLs to Redistribute

来源:互联网 发布:齐柏林航母知乎 编辑:程序博客网 时间:2024/06/06 07:17
Visual C++ Concepts: Adding Functionality
Determining Which DLLs to Redistribute

You can see which DLLs are dependencies of an application by opening the application using the Dependency Walker (Depends.exe), which ships with Visual C++ .NET. Depends.exe is installed to /Microsoft Visual Studio .NET 2003/Common7/Tools/bin. Note, depends.exe is only installed if you select the Win32 Platform SDK Tool, which is in Visual C++ Tools category of the Visual C++ .NET custom installation.

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, use the application until you are sure that all paths were exercised. When you end the profiling session, Depends.exe will show which DLLs were dynamically loaded.

As you use DUMPBIN or Depends.exe to view your dependencies, use the file list in Redist.txt to see which Microsoft-supplied DLLs are redistributable. For more information on Redist.txt, see A List of Redistributable Files.

When using Depends.exe, be aware that a DLL may have a dependency on another DLL or on a version of a specific DLL. You can use Depends.exe on either the development computer or on a target computer. On the development computer, Depends.exe will report 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 will report which of the application's DLLs are either missing or present with an incorrect version.

Normally, you should not redistribute system DLLs (for example, Kernel32.dll, User32.dll, Ole32.dll, ShDocVW.dll, and so on) although there might be exceptions. Be sure to read the corresponding licensing agreements if you encounter such a need. If possible, try to get the system DLLs upgraded either through service packs or by any small redistributable package made available by Microsoft. You can search and identify any such available packages from the Knowledge Base articles in the MSDN Library or at http://support.microsoft.com.

When you install your application DLLs and components (including the redistributable files that ship with Visual C++ .NET), it is recommended that you install them only to the application's local folder. Do not install them to a system folder or a common folder shared by multiple applications. For more information, see Merge Modules, Windows Logo Requirements, and Windows File Protection.

See Also

Redistributing a Native C++ Application | Deployment in Visual Studio