Table 28 Parameters

Parameter

Description

desc

A buffer of memory allocated by the user program. The dynamic loader fills this in with

 

module information.

desc_size

Size in bytes of the desc buffer.

read_tgm_mem

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.

buffer

A buffer supplied by dlmodinfo to read into.

ptr

The virtual memory address to read from.

bufsiz

The size of buffer in bytes.

ident

The value of the ident_parm parameter to dlmodinfo.

ident_parm

Only used to pass the fourth parameter to read_tgt_mem.

load_map_parm

Only used when calling through read_tgt_mem. Contains the starting address of the

 

load map.

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

Page 162
Image 162
HP UX Software Transition Kit (STK) manual Dlclose Routine, Using dlgetname to retrieve pathname, Int dlclosevoid *handle