Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)
dlopen(3) Guardian Native C Library Calls Reference Manual
For Guardian programs, the class MAP DEFINE =_RLDVERBOSE performs the equivalent
action. For example:
ADD DEFINE =_RLDVERBOSE, CLASS MAP, FILE #4
Disposing of Unresolved Symbols
Users can specify an option to the ld or eld linker to control disposition of unresolved symbols in
a loadfile. The option is stored in the loadfile and determines whether rld or dlopen() generates
warnings or errors when it encounters unresolved procedure references in the loadfile.
For unresolved data symbols, dlopen( ) always reports an error.
For unresolved procedure symbols, the options are:
• Report errors; this is the default option set by the ld or eld linker
• Report warnings to the home terminal for references to unresolved procedures, but report
no errors (if RTLD_VERBOSE(1) is used, no warnings are reported)
• Report no errors or warnings, despite references to unresolved procedures
If any procedure symbol is unresolved when a loadfile is loaded, that symbol is bound to a func-
tion named UNRESOLVED_PROCEDURE_CALLED_(). The system (implicit) library
includes a default internal implementation of UNRESOLVED_PROCEDURE_CALLED_();
when called, it generates a nondeferrable SIGILL signal. The run-time loader searches for
UNRESOLVED_PROCEDURE_CALLED_() using the import controls specified in the
loadfile, just as it searches for any other symbol; therefore, a user’sdefinition for the function
takes precedence over the internal definition.
NOTES
The rld dynamic loader is an unprivileged interface; it cannot be invoked from a program or
DLL that is licensed or has callable functions, or from a program with a priv entry point. Process
creation fails if such a file refers to dlopen( ), dlsym( ), dlclose(), dlerror(),ordlresultcode().
Depending upon the circumstances, process-creation error/detail value combinations of 77,11 or
78,7 can result.
RETURN VALUES
Upon successful completion, the dlopen( ) function returns a library handle valid for use with
other DLL functions. This handle is an arbitrary token, not an address; it cannot be assigned to a
pointer and dereferenced.
dlopen() returns a 0 (zero) if the file designated by object_pathname:
• Could not be found
• Could not be opened for execution
• Is not a DLL or an unlicensed public SRL
or if an error occurred during the loading or adjustment of the file’s symbolic references. The
dlerror() or dlresultcode() function should be called immediately to determine the problem.
ERRORS
The dlopen() function does not set the errno variable. Error information is available through the
dlerror() or dlresultcode() function.
Unresolved symbols can cause dlopen( ) to generate warnings or errors, depending on the user-
specified option for treating unresolved symbols. Warnings and errors are reported to the home
terminal.
If the option saved in the object file specifies that unresolved symbols generate errors, dlopen()
returns 0 (zero) without loading any libraries; otherwise, dlopen() returns a valid library handle.
1−60 Hewlett-Packard Company 527192-007