Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ intro(3) — HP-UX 7.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

intro(2)

stdio(3S)

math(5)

hier(5)

ar(1)

cc(1)

f77(1)

ld(1)

lint(1)

nm(1)

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 under the −lc option.  Declarations for some of these functions may be obtained from #include files indicated on the appropriate pages. 

(3G) These functions constitute the graphics library, and are documented in separate manuals. 

(3I) These functions constitute the instrument support library. 

(3M) These functions constitute the Math Library.  They are automatically loaded as needed by the FORTRAN compiler f77(1). They are not automatically loaded by the C compiler, cc(1); however, the link editor searches this library under the −lm option.  Declarations for these functions may be obtained from the #include 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.  Section 3N manual entries are contained in the Networking Reference.

(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 may be obtained from the #include file <stdio.h>. 

(3X) Various specialized libraries.  The files in which these libraries are found are given on the appropriate pages. 

Definitions

A character is any bit pattern able to fit into a byte on the machine.  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 this value will not match that of any legitimate pointer, so many functions that return pointers return it to indicate an error.  NULL is defined as 0 in <stdio.h>; the user can include an appropriate definition if not using <stdio.h>. 

Many groups of FORTRAN intrinsic functions have generic function names that do not require explicit or implicit type declaration.  The type of the function will be determined by the type of its argument(s).  For example, the generic function max will return 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 (the largest-magnitude single-precision floating-point numbers; HUGE is defined in the <math.h> header file) when the function is undefined for the given arguments or when the value is not representable.  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 the 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, (3M)).  Use of lint(1) is highly recommended.

FILES

/lib/libc.a
/lib/libm.a
/usr/lib/libF77.a

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, manual in HP-UX Concepts and Tutorials:  Device I/O and User Interfacing. 

Hewlett-Packard Company  —  HP-UX Release 7.0: Sept 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026