} else {
printf("text base = 0x%x\n", desc.text_base);
}
}
The shl_load Shared Library Management Routines
This section describes the shl_load family of shared library management routines.
NOTE: You can use these routines in both
The shl_load Routine
The shl_load routine explicitly loads a library.
Syntax
shl_t shl_load( const char * path, int flags,
long address )
Parameters
path A
flags Specifies when the symbols in the library must be bound to addresses. It must be one of these values, defined in <dl.h>:
Flag | Definition |
BIND_IMMEDIATE | Binds the addresses of all symbols immediately upon loading the library. |
|
|
BIND_DEFERRED | Binds the addresses when they are first referenced. |
| Be aware that BIND_IMMEDIATE causes the binding of all symbols, and the resolution |
| of all imports, even from older versioned modules in the shared library. If symbols are not |
| accessible because they come from old modules, they are unresolved and shl_load |
| may fail. |
|
|
In addition to the above values, the flags parameter can be ORed with the following values:
Flag | Definition |
|
|
BIND_NONFATAL | Allows binding of unresolved symbols. |
|
|
BIND_VERBOSE | Makes dynamic loader display verbose messages when binding symbols. |
|
|
BIND_FIRST | Inserts the loaded library before all others in the current link order. |
|
|
DYNAMIC_PATH | Causes the dynamic loader to perform dynamic library searching when loading the |
| library. The +s and +b options to the ld command determine the directories the linker |
| searches. This is the default mode if +compat linker option is not specified. |
|
|
BIND_NOSTART | Causes the dynamic loader to not call the initializer, even if one is declared for the |
| library, when the library is loaded or on a future call to shl_load or dlopen. This |
| also inhibits a call to the initializer when the library is unloaded. |
|
|
BIND_RESTRICTED | Causes the search for a symbol definition to be restricted to those symbols that were |
| visible when the library was loaded. |
|
|
168 Shared Library Management Routines