Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The number of functions in C library

Tags:

c

gcc

gnu

glibc

I want to know there are how many functions I can call in C library, e.g. Gnu C library? or Approximately?

like image 921
c21 Avatar asked Sep 14 '25 15:09

c21


1 Answers

If you are in unix like OS, you can use nm utility, part of gnu binutils. In my cygwin environment, nm lists 1570 symbols defined in the text section.

% nm -C /usr/lib/libc.a  | grep -w T | wc -l
1570

Let's exclude the _ variants

% nm -C /usr/lib/libc.a  | grep -w T | grep -v _ | wc -l
751

If you are on windows, try dumpbin utility.

% dumpbin /exports msvcr110.dll

-C in the nm command demangles the symbol names. I do not know how to get dumpbin to print original symbol names. If anyone knows how to, please suggest.

Some functions might be defined in another object file - like libm for math, libnsl for network services etc. To be sure, also look at the library documentation/source.

like image 164
Gowtham Avatar answered Sep 17 '25 05:09

Gowtham