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

Chapter 1 5
Introduction to the HP C/iX Library
Organization of the HP C/iX Library
The executable form of the standard library in XL.PUB.SYS is automatically searched
when any C program is executed. To use the XL form of the library, you must add the
LIBCINIT.LIB.SYS file to the RL list when linking your program.
To use the relocatable form of the standard library, you must add the LIBC.LIB.SYS file to
the RL list when linking your program. In this case, you must not specify the
LIBCINIT.LIB.SYS file.
NOTE
Either the LIBCINIT.LIB.SYS file or the LIBC.LIB.SYS file, but not both,
must be specified in the RL list when linking a C program.
The relocatable library contained in LIBCANSI contains a flag that specifies that
ANSI-conformant behavior is desired. Certain functions, primarily those that perform
input/output operations on text files, interrogate this flag and behave accordingly. To
specify ANSI-conforming behavior for the standard library functions, add
LIBCANSI.LIB.SYS to the RL list when linking your program. If you want behavior
consistent with pre-ANSI releases of the library, do not link with LIBCANSI. Normally,
ANSI-conforming behavior should be requested for new programs.
If you use the CCXLLK command to compile and link a C program, or the CCXLGO command
to compile, link, and run a C program, then LIBCANSI.LIB.SYS is automatically added to
the RL list in the link step if you compiled in ANSI mode (-Aa option). If you compile and
link with separate commands, specify LIBCANSI if you want ANSI-conforming behavior.
The rand and srand functions are not in the XL or RL versions of LIBC.LIB.SYS. To use
the rand and srand functions, you must add the LIBCRAND.LIB.SYS file to the RL list
when linking your program. There is no XL version of these functions. The special
treatment for the rand and srand functions is due to a name conflict between the HP C/iX
library function rand and the MPE/iX compiler library function rand.
The LIBCXL.LIB.SYS file facilitates building additional executable libraries containing the
standard library and should not be linked into C programs.
The following examples link the standard library into a program. In the examples, assume
that the object files MYOBJ1 and MYOBJ2 were created by the HP C/iX compiler and define
the function main. To use the XL version of the standard library in a program called
MYPROG1, specify the following LINK command:
LINK FROM=MYOBJ1; TO=MYPROG1; RL=LIBCINIT.LIB.SYS,
LIBCWC.LIB.SYS The relocatable library that enables an HP C/iX program to expand valid
file set wildcards into fully qualified permanent file names and pass them
into the main program. See the HP C/iX Reference Manual for details.
LIBCXL.LIB.SYS A relocatable library that is used to build the XL form of the standard
library.
LIBM.LIB.SYS The mathematical library functions in RL form.
LIBMANSI.LIB.SYS An ANSI-conforming version of the mathematical library.
Table 1-1. Standard Library Files
File Description