intro(3)
NAME
intro − introduction to subroutines and libraries
SYNOPSIS
#include <stdio.h>
#include <math.h>
DESCRIPTION
This section describes functions found in various libraries, other than those functions that directly invoke HP-UX system primitives, which are described in Section (2) of this volume. Certain major collections are identified by a letter after the section identifier (3):
(3C) These functions, together with the Operating System Calls and those marked (3S), constitute the Standard C Library which is automatically loaded by the C compiler, cc(1). The link editor ld(1) searches this library if the −lc option is specified. Declarations for some of these functions can be obtained from #include files indicated in the appropriate entries.
(3G) These functions constitute the graphics library, and are documented in separate manuals.
(3I) These functions constitute the instrument support (Device I/O ) library.
(3M) These functions constitute the Math Libraries, libm.a and libM.a. All of the functions are in both libraries except for matherr (see matherr(3M) for more details). The HP-UX operating system provides two different libraries due to to conflicts between Issue 2 of the SVID specification and the ANSI C standard. If behavior conforming to SVID Issue 2 is desired, libm.a should be used. If behavior conforming to the ANSI C standard is desired, libM.a should be used. The libm.a library is automatically linked as needed by the FORTRAN compiler (see f77(1)). Neither is automatically loaded by the C compiler (see cc(1)); however, the link editor searches this library if the −lm (for libm.a) or −lM (for libM.a) option is specified. Declarations for these functions are available in the header file <math.h>. Several generally useful mathematical constants are also defined there (see math(5)).
(3N) These functions are applicable to the Internet network, and are part of the standard C library, libc.a.
(3S) These functions constitute the “standard I/O package” (see stdio(3S)). These functions are in the library libc, already mentioned. Declarations for these functions can be obtained from the #include file <stdio.h>.
(3X) Various specialized libraries. The files in which these libraries are found are specified in the appropriate entries.
Definitions
The word character is used to refer to a bit representation that fits in a byte and represents a single graphic character or control function. The null character is a character with value 0, represented in the C language as \0. A character array is a sequence of characters. A null-terminated character array is a sequence of characters, the last of which is the null character. A string is a designation for a null-terminated character array. The null string is a character array containing only the null character. A null pointer is the value that is obtained by casting 0 into a pointer. The C language guarantees that two null pointers always compare equal, and a null pointer always compares unequal to a pointer to any object or function. Consquently, many functions that return pointers return a null pointer to indicate an error. The macro NULL expands to a null pointer constant and is defined in <stddef.h> and certain other headers.
Many groups of FORTRAN intrinsic functions have generic function names that do not require explicit or implicit type declaration. The type of the function is determined by the type of its argument or arguments. For example, the generic function max returns an integer value if given integer arguments (max0), a real value if given real arguments (amax1), or a double-precision value if given double-precision arguments (dmax1).
DIAGNOSTICS
Functions in the C and Math Libraries, (3C) and (3M), may return the conventional values 0 or ±HUGE_VAL (the largest-magnitude double-precision floating-point numbers; HUGE_VAL is defined in the <math.h> header file) when the function is undefined for the given arguments or when the value is not representable. Functions in the Math Libraries may also return ±INFINITY or NaN. In these cases, the external variable errno (see errno(2)) is set to the value EDOM or ERANGE. As many of the FORTRAN intrinsic functions use the routines found in the Math Library, the same conventions apply.
WARNINGS
Library routines in libc.a and libm.a often call other routines in these libraries. Prior to HP-UX release 7.0, a user could define a function having the same name as one of these library routines, and this function would be linked in instead of the library version. In this way, a user could effectively replace a library routine with his own (see matherr(3M) for a supported example of this). More often, this type of linkage would occur unintentionally, causing unexpected behavior which was difficult to debug.
Starting at Release 7.0, object names in libraries have been modified such that they are much less likely to collide with user names. Therefore, calls to library routines from within other library routines are much more likely to call the actual library routine. (matherr(3M) is the only exception to this.)
In spite of these changes, it is still remotely possible for name conflicts to occur. The lint(1) program checker reports name conflicts of this kind as “multiple declarations” of the names in question. Definitions for Sections (2), (3C), and (3S) are checked automatically. Other definitions can be included by using the −l option (for example, −lm includes definitions for the Math Library, libm.a. Use of lint(1) is highly recommended.
FILES
/lib/libc.a Standard I/O, operating system calls, and general purpose routines archive library.
/lib/libc.sl Standard I/O, operating system calls, and general purpose routines shared library.
/lib/libcurses.sl CRT screen handling shared library.
/lib/libm.a SVID2 compliant math archive library.
/lib/libm.sl SVID2 compliant math shared library.
/lib/libM.a XPG3, POSIX.1, ANSI-C compliant math archive library.
/lib/libM.sl XPG3, POSIX.1, ANSI-C compliant math shared library.
/usr/lib/libF77.a General FORTRAN 77 routines archive library.
/usr/lib/libF77.sl General FORTRAN 77 routines shared library.
SEE ALSO
intro(2), stdio(3S), math(5), hier(5), ar(1), cc(1), f77(1), ld(1), lint(1), nm(1).
The introduction to this manual.
Device I/O Library, tutorial in Device I/O Users Guide .
Hewlett-Packard Company — HP-UX Release 9.0: August 1992