nlist() — Get entries from a name list

Standards

Standards / Extensions C or C++ Dependencies
z/OS® UNIX both  

Format

#include <nlist.h>

int nlist(const char *loadname, struct nlist *np);

General description

The nlist() function allows a program to examine the name list in the executable file named by the loadname parameter. It selectively extracts a list of values and places them in the array of nlist structures pointed to by the np parameter.

The name list specified by the np 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 executable file. If the name is found, the type and the value of the name is copied into the nlist structure field. If the name is not found, both the type and value entry will be set to zero.

All entries are set to zero if the specified executable file cannot be read or it does not contain a valid name list.
Notes:
  1. The only variable type that will be supported by this version of nlist() is external function.
  2. nlist() will extract the offset of the external functions from loadname.
  3. The type returned in nlist structure will always be 2 to indicate function if the function name is found in loadname.
  4. loadname must be a HFS linear format load module containing main().
  5. loadname cannot be a dll (dynamic link library) or a fetchable load module.

Returned value

If successful, nlist() returns 0. The offset and type of functions if found will be returned in the nlist structure.

If unsuccessful, nlist() returns -1.

Related information