Table 24 Parameters

Parameter

Definition

 

 

 

 

file

Used to construct a pathname to the shared library file.

 

 

If files contain a slash character (/), dlopen uses the file

 

 

argument itself as the pathname. If not, dlopen searches

 

 

a series of directories for file.

 

 

Any directories specified by the dynamic search path,

 

 

which is set by calling dlsetlibpath

 

 

Any directories specified by the environment variable

 

 

LD_LIBRARY_PATH.

 

 

Any directories specified by the variable SHLIB_PATH.

 

 

Any directories specified by the RPATH of the calling

 

 

load module.

 

 

The default library search path.

 

 

The current working directory.

 

 

 

 

flags

Mode

Definition

 

 

 

 

RTLD_LAZY

Under this mode, only references to data

 

 

symbols are relocated when the library is

 

 

loaded. References to functions are not

 

 

relocated until a given function is invoked

 

 

for the first time. This mode results in better

 

 

performance, because a process may not

 

 

reference all of the functions in any given

 

 

shared object.

 

 

 

 

RTLD_NOW

Under this mode, all necessary relocations

 

 

are performed when the library is first

 

 

loaded. This can cause some wasted effort

 

 

if relocations are performed for functions

 

 

that are never referenced. But it is useful

 

 

for applications that need to know as soon

 

 

as an object is loaded that all symbols

 

 

referenced during execution are available.

 

 

 

 

RTLD_GLOBAL

The shared library's symbols are made

 

 

available for the relocation processing of

 

 

any other object. In addition, symbol

 

 

lookup using dlopen(0, mode) and an

 

 

associated dlsym() allows objects loaded

 

 

with RTLD_GLOBAL to be searched.

 

 

 

 

RTLD_LOCAL

The shared library's symbols are made

 

 

available for relocation processing only to

 

 

objects loaded in the same dlopen

 

 

invocation. If neither RTLD_GLOBAL nor

 

 

RTLD_LOCAL are specified, the default is

 

 

RTLD_LOCAL.

 

 

 

 

RTLD_VERBOSE

Displays verbose messages when binding

 

 

symbols.

 

 

 

Return Values

A successful dlopen call returns to the process a handle which the process can use on subsequent calls to dlsym and dlclose. This value must not be interpreted in any way by the process.

The dlopen routine returns NULL under the following conditions:

file cannot be found.

file cannot be opened for reading.

The dlopen Shared Library Management Routines 149