Where can I find an object file that contains the definition of the printf function?

I am using the gcc compiler and ubuntu 12.04 OS. I want to know where I can find the object file and under which directory that contains the definition of the printf function. Again, I am not looking for a header file that contains the prototype, but an object file that contains the actual definition.

+5
source share
2 answers

Are you looking for an object file or source file?

The .o object file is stored in the library libc.so. On most Linux distributions, this file is located at /lib/libc.so. On Ubuntu 11 and 12, as part of multiarch support , the contents of / lib were ported to /lib/i386-linux-gnuand /lib/x86_64-linux-gnu.

ar (archive), x (extract):

ar x libc.a stdio.o 

, , , . glibc, printf.c( vprintf, vfprintf, Printf).

Launchpad. 2000 .

+4

-

  • , libc, :

    x86_64: $ar -t/usr/lib/x86_64-linux-gnu/libc.a

    i386: $ar -t/usr/lib/i386-linux-gnu/libc.a

  • , printf, /usr/lib/x 86_64-linux-gnu/usr/lib/i386-linux-gnu :

    $nm -o libc.a | grep -w printf

  • , .

0

All Articles