Datasheet
In this way, the system can arrange for a single copy of a shared library to be used by many applications
at once and stored just once on the disk. An additional benefit is that the shared library can be updated
independently of the applications that rely on it. Symbolic links from the
/lib/libm.so file to the actual
library revision (
/lib/libm.so.N where N represents a major version number — 6 at the time of writing)
are used. When Linux starts an application, it can take into account the version of a library required by the
application to prevent major new versions of a library from breaking older applications.
For Linux systems, the program (the dynamic loader) that takes care of loading shared libraries and resolv-
ing client program function references is called
ld.so and may be made available as ld-linux.so.2 or
ld-lsb.so.2 or ld-lsb.so.3. The additional locations searched for shared libraries are configured in the
file
/etc/ld.so.conf, which needs to be processed by ldconfig if changed (for example, if X11 shared
libraries are added when the X Window System is installed).
You can see which shared libraries are required by a program by running the utility
ldd. For example, if
you try running it on your example application, you get the following:
$ ldd program
linux-gate.so.1 => (0xffffe000)
libc.so.6 => /lib/libc.so.6 (0xb7db4000)
/lib/ld-linux.so.2 (0xb7efc000)
In this case, you see that the standard C library (libc) is shared (.so). The program requires major
Version 6. Other UNIX systems will make similar arrangements for access to shared libraries. Refer to
your system documentation for details.
In many ways, shared libraries are similar to dynamic-link libraries used under Windows. The
.so
libraries correspond to .DLL files and are required at run time, and the .a libraries are similar to .LIB
files included in the program executable.
Getting Help
The vast majority of Linux systems are reasonably well documented with respect to the system program-
ming interfaces and standard utilities. This is true because, since the earliest UNIX systems, programmers
have been encouraged to supply a manual page with their applications. These manual pages, which are
sometimes provided in a printed form, are invariably available electronically.
The
man command provides access to the online manual pages. The pages vary considerably in quality
and detail. Some may simply refer the reader to other, more thorough documentation, whereas others
give a complete list of all options and commands that a utility supports. In either case, the manual page
is a good place to start.
The GNU software suite and some other free software use an online documentation system called
info.
You can browse full documentation online using a special program,
info, or via the info command of
The following example outputs are taken from a SUSE 10.3 distribution. Your output
may differ slightly if you are not using this distribution.
14
Chapter 1: Getting Started
47627c01.qxd:WroxPro 9/28/07 8:56 PM Page 14