Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can i find the definition of functions declared in c standard header files like stdlib.h?

I am using Linux (ubuntu).

I want to read the function definitions of some functions which are declared in header files like stdlib.h

I tried looking for stdlib.c but could not find one.

Can anyone please let me know where can i find the corresponding code file on my system.

Forgive me if i am being too naive. Thanks

like image 798
abhi Avatar asked Oct 18 '25 22:10

abhi


2 Answers

You need to download the source code for glibc. Your distribution will typically only ship with a compiled version of the C library. See also the Wikipedia article.

(E.g. on Debian-like systems try apt-get source libc6.)

glibc isn't the only C library for Linux-like systems, there exist a couple of "competitors". For example, uClib is a very small alternative intended for embedded applications.

like image 185
Kerrek SB Avatar answered Oct 20 '25 18:10

Kerrek SB


For most Linux-based systems, the standard library is provided by glibc. You can browse the git repository here:

http://sourceware.org/git/?p=glibc.git;a=tree

Note that much of the interesting source is tucked away under the sysdeps tree, particularly sysdeps/unix/sysv/linux and similar.

like image 34
R.. GitHub STOP HELPING ICE Avatar answered Oct 20 '25 18:10

R.. GitHub STOP HELPING ICE



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!