用于检查.lib文件的工具? [英] Tools for inspecting .lib files?

查看:249
本文介绍了用于检查.lib文件的工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在评估一些文档不足的软件.构建示例项目时,出现链接器错误,如下所示:

I'm evaluating some underdocumented software. When I build a sample project, I'm getting a linker error that looks like:

error LNK2019: unresolved external symbol

此应用程序没有很多lib文件,因此我可以通过反复试验解决此问题,但我知道还有一种优雅的方法可以解决此问题.

There aren't a whole lot of lib files with this app, so I can solve this problem with trial and error, but I know there's a more elegant way is to solve this problem.

在Java世界中,我会 grep FOO * .jar 查找jar,然后在寻找C ++类似物.我正在Visual Studio 2005中使用C ++代码.

In the java world, I would grep FOO *.jar to find the jar and I'm looking for the C++ analog. I'm working with C++ code in Visual Studio 2005.

我怀疑带有/LIST选项的lib.exe实用程序可以获取信息,但是到目前为止,我一直没有成功.它只是打印此:

I suspect the lib.exe utility with the /LIST option can get the information, but I've been unsuccessful so far. It just prints this:


Microsoft (R) Library Manager Version 8.00.50727.762
Copyright (C) Microsoft Corporation.  All rights reserved.

granite50.dll
granite50.dll
granite50.dll
granite50.dll
...

有什么建议吗?

推荐答案

首先,您需要知道您要查找的是哪种类型的库.一些库仅包含DLL的链接(即导入库),而另一些则是成为可执行映像一部分的代码对象(即静态库).从输出的外观来看,您正在查看一个DLL导入库.

First of all you need to know which type of library you are looking at. Some libraries simply contain linkages for a DLL (i.e., import libraries) and others are code objects that become part of the executable image (i.e., static libraries). From the looks of that output, you were looking at a DLL import library.

接下来,您要使用正确的工具. Lib.exe用于从库中提取对象文件,而不是提取对象文件.这与Java的jar实用程序几乎相同. Microsoft提供了dumpbin.exe,它将从库中转储信息.我看到 LarryF 已经提到了这一点.

Next you want to use the right tool. Lib.exe is used to extract object files from libraries and what-not. This is pretty much the same as the jar utility for Java. Microsoft provides dumpbin.exe which will dump information from the library. I see that LarryF already mentioned this.

对于导入库,运行dumpbin.exe -headers foo.lib并将其重定向到输出文件.输出将包含相关DLL导出的每个符号的摘要.搜索以" Symbol name :"开头的行.请注意,如果要完全匹配,则在符号名称"之前和之后有两个空格.您还可以通过findstr运行输出,以生成符号列表,并将其重定向到文本文件(如果您希望更好看的话):

For import libraries, run dumpbin.exe -headers foo.lib and redirect it to an output file. The output will contain snippets for each symbol that the related DLL exports. Search for lines starting with " Symbol name :". Note that there are two spaces before and after "Symbol name" if you want an exact match. You can also run the output through findstr to generate a list of symbols and redirect that to a text file if you want something a little nicer to look at:

dumpbin.exe -headers foo.lib | findstr /c:"  Symbol name  :" > foo-exports.txt

另一个选择是使用depends.exe打开相关的DLL.

The other option is to open the related DLL with depends.exe.

这篇关于用于检查.lib文件的工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆