简体   繁体   English

如何找出依赖LIB文件的DLL列表?

[英]How to find out the list of DLLs dependent on a LIB file?

Since my project is very huge, while debugging I manually disable the loading of all modules in Visual Studio, and then enable only those DLLs in which I have to debug. 由于我的项目非常庞大,因此在调试时,我会手动禁用Visual Studio中所有模块的加载,然后启用必须在其中调试的DLL。 This works as expected. 这按预期工作。

But since the list of modules in Visual Studio doesn't contain LIB files, how can I debug the code inside a particular static library? 但是,由于Visual Studio中的模块列表不包含LIB文件,如何调试特定静态库中的代码?

Is there an option to see the list of DLLs which are linked to a library file (.lib) ? 是否可以查看链接到库文件(.lib)的DLL列表?

A static library isn't linked with anything. 静态库没有任何链接。 It is just a bag of object files that you offer to the linker from which to pick the ones it needs to define the external symbols in your program. 这只是一堆目标文件,您可以将其提供给链接器,以从中选择定义程序中外部符号所需的文件。 It extracts the object files that it needs from the static library and embeds them into your program. 它从静态库中提取所需的目标文件,并将其嵌入到程序中。

So, suppose abc.lib contains object files a.obj , b.obj , c.obj . 因此,假设abc.lib包含目标文件a.objb.objc.obj You build a program prog by linking main.obj and abc.lib . 为您打造一个程序prog通过链接main.objabc.lib main.obj needs something defined in a.obj plus something defined in c.obj but nothing defined in b.obj . main.obj需要main.obj定义的a.obj以及a.obj定义的内容,而c.obj没有定义的b.obj Then prog is exactly the same as if you had simply linked the three object files main.obj , a.obj , c.obj and not mentioned abc.lib at all. 然后, prog与您只是简单地链接了三个对象文件main.obja.objc.obj而根本没有提到abc.lib

Now a.obj or c.obj might call functions externally defined in one or more DLLs. 现在, a.objc.obj可以调用在一个或多个DLL中外部定义的函数。 Maybe main.obj calls functions that are externally defined in the same or other DLLs. 也许main.obj调用在相同或其他DLL中外部定义的函数。 prog will have to be linked with those DLLs - no more and no less. prog将不得不与这些DLL链接-不多也不少。 The DLL dependencies of main.obj + a.obj + c.obj are the DLL dependencies of your prog , and vice versa. main.obj + a.obj + c.obj的DLL依赖关系是prog的DLL依赖关系,反之亦然。 There aren't any that are concealed by linking abc.lib rather than a.obj and c.obj . 链接abc.lib而不是a.objc.obj隐藏了任何c.obj

作为测试,我将使用静态库创建一个虚拟dll,然后通过依赖关系遍历器(或vs链接过程)查看该dll,然后找到链接的dll。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM