nlist
Purpose
Gets entries from a name list.
Library
Standard C Library (libc.a)
Syntax
#include <nlist.h>
int nlist (filename, nl)
char *filename;
struct nlist *nl;
Description
The nlist subroutine allows a program to examines the
name list in the executable file named by the filename
parameter. It selectively extracts a list of values and
places them in the array of nlist structures pointed to
by the nl parameter.
The name list specified by the nl parameter consists of
an array of structures containing names of variables,
types, and values. The list is terminated with an
element that has a null string in the name structure
member. Each variable name is looked up in the name list
of the file. If the name is found, the type and value of
the name are inserted in the next two fields. The type
field is set to 0 unless the file was compiled with the
-g option. If the name is not found, both the type and
value entries are set to 0.
All entries are set to 0 if the specified file cannot be
read or if it does not contain a valid name list.
You can use the nlist subroutine to examine the system
name list kept in the /unix file. By examining this
list, you can ensure that your programs obtain current
system addresses.
The nlist.h header file is automatically included by
a.out.h for compatibility. However, do not include
a.out.h if you only need the information necessary to use
the nlist subroutine. If you do include a.out.h, follow
the #include statement with the line:
#undef n_name
Return Value
Upon successful completion, a value of 0 is returned. If
the nlist subroutine fails, a value of -1 is returned.
Related Information
In this book: "a.out."
The cc command in AIX Operating System Commands
Reference.