HP-UX Linker and Libraries User's Guide

Table 28 Parameters
DescriptionParameter
A buffer of memory allocated by the user program. The dynamic loader fills this in with
module information.
desc
Size in bytes of the desc buffer.desc_size
A pointer to a function used by dlmodinfo to retrieve needed information. If the value
is NULL, the dynamic loader uses its own internal data structures to find the correct load
module and ignore the ident_parm and load_map_parm parameters.
read_tgm_mem
A buffer supplied by dlmodinfo to read into.buffer
The virtual memory address to read from.ptr
The size of buffer in bytes.bufsiz
The value of the ident_parm parameter to dlmodinfo.ident
Only used to pass the fourth parameter to read_tgt_mem.ident_parm
Only used when calling through read_tgt_mem. Contains the starting address of the
load map.
load_map_parm
Return Values
dlgetname returns the pathname of a load module represented by desc. If desc does not
describe a loaded module, dlgetname returns NULL.
Description
The dlgetname routine is one of a family of routines that give the user direct access to the dynamic
linking facilities. The read_tgt_mem, ident_parm, and load_map_parm parameters are
identical to those for the dlmodinfo routine. The caller of dlgetname must copy the return value
to insure that it is not corrupted.
Using dlgetname to retrieve pathname
The following code sequence shows how to use dlgetname to retrieve the pathname of a load
module. This example uses dlget to get a load_module_desc of the required load module
and passes that load_module_desc to dlgetname to retrieve the pathname.
void* handle;
struct load_module_desc desc;
char* dll_name;
/* Get load module of the index'th shared library */
handle = dlget(1, &desc, sizeof(struct load_module_desc));
/* Retrieve pathname of the shared library */
dll_name = dlgetname(&desc,
sizeof(struct load_module_desc),
NULL,
0,
NULL);
printf("pathname of 1st shared library : %s\n", dll_name);
The dlclose Routine
The dlclose routine closes a shared library.
Syntax
int dlclose(void *handle);
162 Shared Library Management Routines