Kenwood HP 9000 Personal Computer User Manual


 
224 Chapter 6
Shared Library Management Routines
The shl_load Shared Library Management Routines
Look for a symbol in the data segment (for example,
variables).
TYPE_UNDEFINED
Look for any symbol.
TYPE_STORAGE
32-bit mode only.
TYPE_TSTORAGE
32-bit mode only.
value A pointer in which shl_findsym stores the address of
sym, if found.
Return Value
If successful, shl_findsym returns an integer (int) value zero. If
shl_findsym cannot find sym, it returns 1 and sets errno to zero. If
any other errors occur, shl_findsym returns 1 and sets errno to one
of these values (defined in <errno.h>):
ENOEXEC A format error was detected in the specified library.
ENOSYM A symbol on which sym depends could not be found.
EINVAL The specified handle is invalid.
Description
To call a routine or access data in an explicitly loaded library, first get the
address of the routine or data with shl_findsym.
To call a routine in an explicitly loaded library
1. declare a pointer to a function of the same type as the function in the
shared library
2. using shl_findsym with the type parameter set to
TYPE_PROCEDURE, find the symbol in the shared library and assign
its address to the function pointer declared in Step 1
3. call the pointer to the function obtained in Step 2, with the correct
number and type of arguments
To access data in an explicitly loaded library