How to See the Contents of Windows library (*.lib)

2019-01-03 01:35发布

I have a binary file - Windows static library (*.lib).
Is there a simple way to find out names of the functions and their interface from that library ?

Something similar to emfar and elfdump utilities (on Linux systems) ?

7条回答
来,给爷笑一个
2楼-- · 2019-01-03 01:39

1) Open a Developer Command Prompt for VS 2017 (or whatever version you have on your machine)(It should be located under: Start menu --> All programs --> Visual Studio 2017 (or whatever version you have on your machine) --> Visual Studio Tools --> Developer Command Prompt for VS 2017.

2) Enter the following command:

dumpbin /EXPORTS my_lib_name.lib

查看更多
手持菜刀,她持情操
3楼-- · 2019-01-03 01:42

DUMPBIN /EXPORTS Will get most of that information and hitting MSDN will get the rest.

Get one of the Visual Studio packages; C++

查看更多
Evening l夕情丶
4楼-- · 2019-01-03 01:47

"dumpbin -exports" works for dll, but sometimes may not work for lib. For lib we can use "dumpbin -linkermember" or just "dumpbin -linkermember:1".

查看更多
Root(大扎)
5楼-- · 2019-01-03 01:50

Assuming you're talking about a static library, DUMPBIN /SYMBOLS shows the functions and data objects in the library. If you're talking about an import library (a .lib used to refer to symbols exported from a DLL), then you want DUMPBIN /EXPORTS.

Note that for functions linked with the "C" binary interface, this still won't get you return values, parameters, or calling convention. That information isn't encoded in the .lib at all; you have to know that ahead of time (via prototypes in header files, for example) in order to call them correctly.

For functions linked with the C++ binary interface, the calling convention and arguments are encoded in the exported name of the function (also called "name mangling"). DUMPBIN /SYMBOLS will show you both the "mangled" function name as well as the decoded set of parameters.

查看更多
Deceive 欺骗
6楼-- · 2019-01-03 01:52

I wanted a tool like ar t libfile.a in unix.
The windows equivalent is lib.exe /list libfile.lib.

查看更多
闹够了就滚
7楼-- · 2019-01-03 01:56

LIB.EXE is the librarian for VS

http://msdn.microsoft.com/en-us/library/7ykb2k5f(VS.80).aspx

(like libtool on Unix)

查看更多
登录 后发表回答