nlist_pa.3c (2010 09)
n
nlist_pa(3C)
PA-RISC Systems Only
nlist_pa(3C)
NAME
nlist_pa: nlist(), nlist64() - get entries from name list on PA-RISC systems
SYNOPSIS
nlist()
Command:
cc [flag]... cfile...
#include <nlist.h>
int nlist(
const char *file_name ,
struct nlist *nl
);
nlist64()
Command: cc [flag]... cfile...
-lelf [library ]...
#include <nlist.h>
int nlist64(
const char *file_name ,
struct nlist64 *nl
);
Remarks
The use of symbol table type and value information is inherently nonportable. The use of nlist() or
nlist64() should reduce the effort required to port a program that uses such information, but complete
portability across all HP-UX implementations cannot be expected.
This manpage describes
nlist() and nlist64() for PA-RISC systems. For
nlist() and
nlist64() on Integrity systems, see nlist_ia (3C).
DESCRIPTION
nlist() and nlist64() have basically the same functionality except that
nlist64() uses the
nlist64 structure and can process SOM or ELF files. nlist() uses the nlist structure and can only
process SOM files.
The
nlist() or nlist64() function 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/nlist64 structures pointed to by nl. The array of nlist/nlist64 structures initially contains
only the names of variables. Once the nlist() or nlist64() function has been called, the variable
names are augmented with symbol information. 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, the symbol’s type, scope, and value in the file is inserted into the
name list structure. For nlist64(), if the file searched is an ELF file, the section index is also
inserted. For nlist() and SOM files, the subspace index is inserted. On wide-mode systems, the sym-
bol value is 64-bit. If the file searched is a SOM file, then the value field is zero padded. If the name is
not found, the fields in the name list structure are set to 0. The structures nlist and nlist64 are
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 infor-
mation is extracted from the symbol table used by the linker, ld(1).
On machines that have such a file, this subroutine is useful for examining the system name list kept in
file
/stand/vmunix. In this way programs can obtain system addresses that are up to date.
RETURN VALUE
All
nlist/nlist64 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() and nlist64() return:
-1 An error occurred.
0 Success.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1