bjskishore123
bjskishore123

Reputation: 6342

how to find classes present in a c++ library (.lib)?

what tool can I use to find classes present in a C++ static library (.lib) ? This information is for building a library in one solution and use it in another solution by giving lib as input to linker. As the lib can come from 3rd parties, its difficult to find what services it is offering.

Upvotes: 3

Views: 816

Answers (2)

Jerry Coffin
Jerry Coffin

Reputation: 490148

Usually from the documentation and headers. If you don't have that, you could use dumpbin -exports or dumpbin -symbols on it to get a list of exported functions (mostly, -symbols for static librarys, -exports for a link library for a DLL).

If the code was written in (Microsoft) C++, and the public names are mangled, that can tell you quite a bit (return types, parameter types). If they're basically C functions (either from a C compiler, or a C++ compiler but marked with extern "C"), the names won't be mangled, so it won't be able to tell you nearly as much (just names, nothing about the type or even number of parameters).

Upvotes: 2

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181290

If it's a third party library you usually need at least header files (usually .h) that will contain class declarations with its corresponding members. You will use that header file to compile your code and then link with the compiled library.

There is no standard way of getting that information from the compiled binary.

Upvotes: 1

Related Questions