Kenwood HP 9000 Personal Computer User Manual


 
Chapter 6 249
Shared Library Management Routines
The dlopen Shared Library Management Routines
struct load_module_desc {
unsigned long text_base;
unsigned long text_size;
unsigned long data_base;
unsigned long data_size;
unsigned long unwind_base;
unsigned long linkage_ptr;
unsigned long phdr_base;
unsigned long tls_size;
unsigned long tls_start_addr;
}
Example
The following code sequence shows how to use dlget to retrieve
information about loaded modules. The following code sequence prints
the text base of all loaded modules:
void* handle;
int index;
struct load_module_desc desc;
for (index = 0; ; i++) {
handle = dlget(i, &desc, sizeof(struct load_module_desc));
if (handle = NULL) {
printf(“%s\n”, dlerror());
break;
}
else {
printf(“library %d text base = %lx\n”, index,
desc.text_base);
}
}
The dlmodinfo Routine
Retrieves information about a loaded module (program or shared
library).
Syntax
cc [flag...] file... -ldl [library]...
#include <dlfcn.h>
unsigned long dlmodinfo(unsigned long ip_value,
struct load_module_desc *desc,
size_t desc_size,
void *(*read_tgt_mem)(void* buffer,
unsigned long ptr,
size_t bufsiz,
int ident),