Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

How do I view the contents of a lib file?

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.

How do I view the contents of a static library?

I just discovered that you can use readelf -a to display the contents of all the object files in a static library. Invoke the readelf command like this: $ readelf -a mystaticlib.

How do I find Windows library?

To show libraries in File Explorer, select the View tab, and then select Navigation pane > Show libraries.

What are .LIB files in Windows?

LIB (lib.exe) creates standard libraries, import libraries, and export files you can use with LINK when building a program. LIB runs from a command prompt. You can use LIB in the following modes: Building or modifying a COFF library.


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.


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


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


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


LIB.EXE is the librarian for VS

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

(like libtool on Unix)


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

Get one of the Visual Studio packages; C++


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