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.
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.
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.
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.
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.
On Windows you can use dumpbin
. On Linux and friends you can use nm
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With