在c++中可以使用LoadLibrary来动态加载dll,最近遇到了一个跟发布有关的问题。在自己的电脑上运行没问题,但是在客户机上却LoadLibrary失败,返回126的错误。使用Dependency walker分析之后,发现是要动态加载的类库依赖另外一个类库,客户机找不到该类库,所以失败。下面简单介绍一下Dependency walker的使用方法。
Dependency walker是一个可以用来查看windows上可执行文件依赖库的工具。可以用来分析库的装载相关的错误。
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.