O'Reilly logo

Linux: Embedded Development by Chris Simmonds, Alex González, Alexandru Vaduva

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Looking at the components of the C library

The C library is not a single library file. It is composed of four main parts that together implement the POSIX functions API:

  • libc: The main C library that contains the well-known POSIX functions such as printf, open, close, read, write, and so on
  • libm: Maths functions such as cos, exp, and log
  • libpthread: All the POSIX thread functions with names beginning with pthread_
  • librt: The real-time extensions to POSIX, including shared memory and asynchronous I/O

The first one, libc, is always linked in but the others have to be explicitly linked with the -l option. The parameter to -l is the library name with lib stripped off. So, for example, a program that calculates a sine function by calling sin() would be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required