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

6 Chapter1
Introduction to the HP C/iX Library
Organization of the HP C/iX Library
LIBCANSI.LIB.SYS
To use the rand function with the RL version of the standard library in a program called
MYPROG2, specify the following LINK command:
LINK FROM=MYOBJ2;TO=MYPROG2;RL=LIBCRAND.LIB.SYS,LIBC.LIB.SYS,
LIBCANSI.LIB.SYS
For a complete specification of available functions, see chapter 5.
The Math Library
The math library consists of additional mathematical functions, such as trigonometric and
logarithmic functions, that perform floating-point operations.
Two relocatable versions of the math library are provided. The library in
LIBMANSI.LIB.SYS conforms to the ANSI standard for C and is the version you should use.
The library in LIBM.LIB.SYS is compatible with older, pre-ANSI releases of the library,
and is for programs that may be relying on non-ANSI behaviors.
The primary difference between the two libraries is in the way they handle an error, such
as attempting to compute the square root of a negative value. The ANSI version of the
library calls a user-written function named _matherr if one is provided; no error message
is displayed. The older version of the library calls a user-written function named matherr
if one is provided. Otherwise, an error message is displayed.
To use the math library, you must add the library file to your RL list when linking your
program. The math library must precede the standard library (LIBC.LIB.SYS) in the RL
list if the RL form of the standard library is used. The ordering of the files is significant
because of the interdependencies between the libraries. The ordering is not significant if
the XL form of the standard library is linked.
The following example links the math library into a program. In the example, assume the
object file MYOBJ was created by the HP C/iX compiler and defines the function main. To use
the ANSI-conforming math library and the RL version of the standard library in a
program called MYMATH, specify the following link command:
LINK FROM=MYOBJ;TO=MYMATH;RL=LIBMANSI.LIB.SYS,LIBC.LIB.SYS,
LIBCANSI.LIB.SYS
For a complete specification of math library functions, see chapter 5.
Other Library Functions
In addition to the standard library functions and the math library functions, HP C/iX
provides another set of functions that perform miscellaneous tasks.
For a complete specification of available functions, see chapter 5.