HP C/iX Reference Manual (31506-90011)
Chapter 8 123
Compiling and Running HP C/iX Programs
Linking the C Library
The rand and srand functions are conceptually part of the standard library but reside in a
different library file, LIBCRAND.LIB.SYS. To use these functions, add the
LIBCRAND.LIB.SYS file to the RL list when linking your program. These functions are
not available in XL form. This 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.
Examples
To link the object file MYOBJ and the RL form of the standard library into the program file
MYPROG, enter:
LINK FROM=MYOBJ; TO=MYPROG; RL=LIBC.LIB.SYS
To link the object file MYOBJ together with the random number generation functions rand
and srand, the math library routines, and the RL form of the standard library, enter:
LINK FROM=MYOBJ; TO=MYPROG; RL=LIBCRAND.LIB.SYS,LIBM.LIB.SYS,LIBC.LIB.SYS
Remember that either LIBC.LIB.SYS or LIBCINIT.LIB.SYS must be linked into your
program.
To link a program under ANSI mode, enter:
LINK FROM=OBJFILE; TO=PROGFILE; RL=LIBCINIT.LIB.SYS,LIBCANSI.LIB.SYS
Non-ANSI is the default mode.