HP C/iX Library Reference Manual (30026-90004)

4 Chapter1
Introduction to the HP C/iX Library
Organization of the HP C/iX Library
Organization of the HP C/iX Library
The HP C/iX library consists of several files that can be divided into three groups:
standard library functions, mathematical library functions, and library functions available
only on HP 3000 Series 900 computers.
If you are developing POSIX applications on MPE/iX, you will be using the POSIX/iX
library. This library is separate from the HP C/iX library and is organized differently. The
POSIX/iX library is described in the MPE/iX Developer's Kit Reference Manual.
The Standard Library
The standard library consists of the input/output functions, the general utility functions,
and the program startup routines. All C programs must link in the standard library
because it contains the startup routines necessary for program execution. Failure to link in
this library results in a linker or loader error.
The standard C library functions are provided in three different forms: a relocatable
library (LIBC.LIB.SYS), an executable library (XL.PUB.SYS), and a relocatable library that
is suitable for adding to an executable library that you build (LIBCXL.LIB.SYS).
Each form of the library is intended for different uses. The relocatable form
(LIBC.LIB.SYS) is for programmers who want the HP Link Editor/iX to bind copies of
library functions to the application program at link time. This reduces the amount of
dynamic binding that must be done at run time. However, this makes less efficient use of
memory space because each application duplicates the library functions that it uses.
The executable forms of the library are placed into shared libraries that can be accessed
when applications written in C are executed. System memory usage decreases when C
programs access the shared library. Only one copy of each function is loaded into the
computer's main memory. For example, if several applications use printf, only one copy of
the actual printf executable code is loaded into memory. All applications share the same
copy.
The files that contain the standard library are listed in <Undefined Cross-Reference>:
Table 1-1. Standard Library Files
File Description
XL.PUB.SYS The executable library (XL) form of the standard library, including
executable libraries from other subsystems and languages.
LIBCINIT.LIB.SYS The code necessary to initialize the XL form of standard library.
LIBC.LIB.SYS The relocatable library (RL) form of the standard library functions.
LIBCANSI.LIB.SYS The relocatable library that should be linked along with LIBCINIT or
LIBC if conformance to ANSI C is desired.
LIBCRAND.LIB.SYS The random number related functions, rand and srand, in RL form.