Window 下如何检查 DLL 依赖(How to check for DLL dependency?)


主要有如下几种方法,根据IDE环境或者已装软件,灵活选用相关工具。推荐方法3和方法4。

  1. 安装 Visual Studio,加载 "Developer Command Prompt for VS 2017",使用 dumpbin 工具
dumpbin /dependents your_dll_file.dll
  1. 安装 Cygwin,打开 Cygwin Terminal,可以运行 linux 指令
ldd your_dll_file.dll

参考链接:https://stackoverflow.com/questions/7378959/how-to-check-for-dll-dependency

  1. 安装 git bash ,直接可以使用linux ldd指令。
ldd your_dll_file.dll
  1. 利用 windows API 实现linux ldd 功能,下载 ldd_win,将可执行程序添加到环境变量中,就可以系统终端中调用 ldd finename 查看依赖。

  2. http://dependencywalker.com/ 工具

Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules. For each module found, it lists all the functions that are exported by that module, and which of those functions are actually being called by other modules. Another view displays the minimum set of required files, along with detailed information about each file including a full path to the file, base address, version numbers, machine type, debug information, and more.