Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List functions in *.lib on Windows

When I run lib /list mylib.lib I see some contained .obj files, but no information about the functions similar to this:

Path\file1.obj
Path\file2.obj
Path\file3.obj

If I open the .lib file as an archieve I can see that there are a number of files 1.txt, ..., n.txt in addition to the object files. Those txt files seem to contain information about the functions in the .obj files on the format:

:
Path\file1.obj    ?function_name@...
:

Thus some info can be retrieved that way.

But isn't there a better way to get the function info ? For example using lib.exe, dumpbin.exe or another tool ? Also in a more readable/demangled format ? So far I had no luck finding that.

There is a related question here but it does not discuss what to do with object files contained in a .lib file.

like image 678
Zitrax Avatar asked Feb 10 '23 14:02

Zitrax


1 Answers

You need to use dumpbin. (See dumpbin on msdn for more information.)

dumpbin /symbols /exports mylib.lib

You can also use dumpbin followed by undname. (See undname.) For example:

dumpbin /all /exports mylib.lib > mylib.txt
undname mylib.txt

Of course you need to do this from a command prompt from which the Visual Studio tools are in your path. With my install dumpbin and undname are at:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\dumpbin.EXE
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\undname.EXE

A Visual Studio Command prompt is available from the program menu. But I get one by simply calling

"%VS120COMNTOOLS%..\..\vc\vcvarsall" amd64
like image 165
Phil Avatar answered Feb 13 '23 03:02

Phil