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

WindowsStatic LibrariesLibraries

Windows Problem Overview


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) ?

Windows Solutions


Solution 1 - Windows

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.

Solution 2 - Windows

Open a Visual Studio Command Prompt

dumpbin /ARCHIVEMEMBERS openssl.x86.lib

or

lib /LIST openssl.x86.lib

or just open it with 7-zip :) its an AR archive

Solution 3 - Windows

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

Solution 4 - Windows

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

Solution 5 - Windows

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

Get one of the Visual Studio packages; C++

Solution 6 - Windows

LIB.EXE is the librarian for VS

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

(like libtool on Unix)

Solution 7 - Windows

  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

Solution 8 - Windows

Like it can be seen in other answers you'll have to open a Developer Command Prompt offered in your version of Visual Studio to have dumpbin.exe in your execution path. Otherwise, you can set the necessary environment variables by hand.

dumpbin /EXPORTS yourlibrary.lib will usually show just a tiny list of symbols. In many cases, it won't show the functions the library exports.

dumpbin /SYMBOLS /EXPORTS yourlibrary.lib will show that symbols, but also an incredibly huge amount of other symbos. So, you got to filter them, possibly with a pipe to findstr (if you want a MS-Windows tool), or grep.

Searching the Static keyword using one of these tools seems to be a good hint.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNick BorodulinView Question on Stackoverflow
Solution 1 - WindowsTim LesherView Answer on Stackoverflow
Solution 2 - WindowsTanguyView Answer on Stackoverflow
Solution 3 - WindowslgwestView Answer on Stackoverflow
Solution 4 - WindowsFrankView Answer on Stackoverflow
Solution 5 - WindowsjimView Answer on Stackoverflow
Solution 6 - WindowsLou FrancoView Answer on Stackoverflow
Solution 7 - Windowsuser3292568View Answer on Stackoverflow
Solution 8 - WindowsHilton FernandesView Answer on Stackoverflow