NLIST(3C) — HP-UX
Series 200, 300, 800 Only
NAME
nlist − get entries from name list
SYNOPSIS
#include <nlist.h>
int nlist (file-name, nl)
char ∗file-name;
struct nlist ∗nl;
REMARKS
The use of symbol table type and value information is inherently non-portable. Use of nlist should reduce the effort required to port a program which uses such information, but complete portability across all implementations of HP−UX cannot be expected.
DESCRIPTION
Nlist examines the name list in the executable file whose name is pointed to by file-name, and selectively extracts a list of values and puts them in the array of nlist structures pointed to by nl. The array of nlist structures initially contains only the names of variables. Once nlist has been called, the variable names are augmented with types and values. The list is terminated by a null name, which consists of a null string in the variable name position of the structure. The name list of the file is searched for each variable name. If the name is found, type and value information from the file is inserted into the name list structure. If the name is not found, type and value fields are set to zero. The structure nlist is defined in the include file <nlist.h>. See a.out(4) and nlist(4) for further description of the symbol table structure.
The file must have the organization and symbol table described for an a.out file in a.out(4). The information is extracted from the symbol table used by the loader, ld(1).
On machines which have such a file, this subroutine is useful for examining the system name list kept in the file /hp-ux. In this way programs can obtain system addresses that are up to date.
RETURNS
All nlist structure fields are set to 0 if the file cannot be found or if it is not a valid object file containing a linker symbol table.
Nlist returns −1 upon error; otherwise it returns 0.
NOTES
The <nlist.h> header file is automatically included by <a.out.h> for compatibility. However, if the only information needed from <a.out.h> is for use of nlist, then including <a.out.h> is discouraged. If <a.out.h> is included, the line “#undef n_name” may need to follow it.
SEE ALSO
Hewlett-Packard Company — Version B.1, May 11, 2021