Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would you list the available functions etc contained within a compiled library?

Tags:

c++

linker

ld

How do I determine whether a function exists within a library, or list out the functions in a compiled library?

like image 315
Anthony Avatar asked Dec 24 '08 19:12

Anthony


People also ask

How do you link a library in Makefile?

You can set these when you run make : LIBS=-lmylib LDFLAGS=-L/path/to/mylib make . This relies on the Makefile having been written to use such variables however, which one generated by a system like autoconf probably will, but one written by hand may not.

Do libraries contain a main () function?

A collection of files used as a library, you should, as long as there is only one main in the program. Call it something else. You can't have main() in a library, that's just silly.

How do I read a .a library file?

Dev-C++ by default is installed with the MinGW/GCC compiler. If the archive is not specifically built to work with MinGW (for example it may be a Cygwin or Linux archive), you will not be able to link it to MinGW generated code. If the archive is a MinGW/GCC compatible library, then you simply link it to your code.


1 Answers

You can use the nm command to list the symbols in static libraries.

nm -g -C <libMylib.a>
like image 100
codelogic Avatar answered Sep 21 '22 03:09

codelogic