Noeud:The GNU C Library, Noeud « Next »:, Noeud « Previous »:Introduction, Noeud « Up »:Top



The GNU C Library

The beating heart of the entire GNU system is the GNU C language runtime: glibc. All of the various applications that comprise the GNU development environment (indeed the entire GNU system) call upon the services of the GNU C library one way or another. In this chapter we will talk about some of the GNU extensions to the usual C APIs that you have access to only when you use the GNU C library. We do not aim to be exhaustive, and we won't even cover all of the GNU extensions, but the reference manual that ships with GNU libc has details of every function and macro that glibc implements. Our aim here is to give you a flavour of the extra functionality you get when you use the GNU implementation of the C runtime library.

Throughout this book we talk about various extensions implemented by the GNU system, by which we mean additional features or programming interfaces you will have access to when you use a GNU system, beyond those available in a vanilla UNIX environment. More specifically, in this chapter we will be describing mostly glibc extensions, which are some of the extra features the GNU C library gives you access to.

Although glibc works best in conjunction with GCC, the library is carefully written to be used with almost any modern, standards conformant C compiler. Where we mention GCC extensions, we are referring to additional C language features you will have access to only when you use GCC; if, for some reason, you are using glibc but not GCC, you will of course be able to use glibc extensions in the context of the C language features provided by your own compiler, but not have the advantage of using any GCC extensions.

Historically, the fundamental design for the APIs that comprise the standard C library was set out in the late 1960's. Since then, not only has computer science come a long way, but the operating environment that the library codifies has changed considerably. The GNU C library authors have added features to address these changes to some extent, but also to make glibc somewhat more pleasant to use than it would be without the extensions they have added. If it is important that your code needs to compile and build in a non-GNU environment, then using the glibc extensions could give you a headache in the long run. This is certainly mitigated to a very large extent by the fact that glibc itself is extremely portable: installing glibc on the target machine is often an easier option than trying to write your code without the benefits gained from the glibc extensions.