Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out what functions a static C library has

I have a static C library (say mylib.a) and I was wondering if it's possible to find out what functions are implemented inside that file. I don't have a corresponding header file. what I need is like the equivalent of javap for Java.

like image 408
cd1 Avatar asked Mar 29 '10 18:03

cd1


People also ask

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.

What does static library contain?

In the C programming language, a static library is a compiled object file containing all symbols required by the main program to operate (functions, variables etc.) as opposed to having to pull in separate entities. Static libraries aren't loaded by the compiler at run-time; only the executable file need be loaded.

What are inbuilt library functions in C?

Library functions are built-in functions that are grouped together and placed in a common location called library. Each function here performs a specific operation. We can use this library functions to get the pre-defined output. All C standard library functions are declared by using many header files.

Where are library functions stored in C?

If the library is static, the functions are linked into the executable image. They get loaded into memory along with the rest of the executable.


1 Answers

On Windows you can use dumpbin. On Linux and friends you can use nm.

like image 179
James McNellis Avatar answered Oct 20 '22 06:10

James McNellis