Chapter 6 231
Shared Library Management Routines
The shl_load Shared Library Management Routines
int show_lib_info(shl_t libH)
{
struct shl_descriptor *desc;
if (shl_gethandle(libH, &desc) == -1)
{
fprintf(stderr, "Invalid library handle.\\n");
return -1;
}
printf("library path: %s\\n", desc->filename);
printf("text start: %#10lx\\n", desc->tstart);
printf("text end: %#10lx\\n", desc->tend);
printf("data start: %#10lx\\n", desc->dstart);
printf("data end: %#10lx\\n", desc->dend);
return 0;
}
The shl_definesym Routine
Adds new symbols to the global shared library symbol table.
Syntax
int shl_definesym( const char *sym,
short type,
long value,
int flags )
Parameters
sym A null-terminated string containing the name of the
symbol to change or to add to the process's shared
library symbol table.
type The type of symbol — either TYPE_PROCEDURE or
TYPE_DATA.
value If value falls in the address range of a currently loaded
library, an association will be made and the symbol is
undefined when the library is unloaded. (Note that
memory dynamically allocated with malloc(3C) does
not fall in the range of any library.) The defined symbol
may be overridden by a subsequent call to this routine
or by loading a more visible library that provides a
definition for the symbol.
flags Must be set to zero.