dlsetlibpath.3c (2010 09)

d
dlsetlibpath(3C) dlsetlibpath(3C)
NAME
dlsetlibpath() - set the dynamic search path used to locate shared libraries
SYNOPSIS
cc [flag]... file...
-ldl [library ]...
#include <dlfcn.h>
int dlsetlibpath(const char *libpath, int flags)
Multithread Usage
This routine is thread-safe. Calls to dlsetlibpath()
affect all subsequent calls to
dlopen(),
dlopene(), and dlgetfileinfo()
, on any thread.
DESCRIPTION
dlsetlibpath()
is one of a family of routines that give the user direct access to the dynamic linking
facilities (using the
-ldl option on the compiler or
ld command line). dlsetlibpath()
sets the
dynamic search path used by
dlopen(), dlopene()
, and dlgetfileinfo()
to locate shared
libraries.
libpath is the dynamic search path. It is a list of one or more path names separated by colons (
:).
When searching for a library, the dynamic loader uses search paths in the following default order:
1. The dynamic search path specified in a call to
dlsetlibpath()
.
2. The
LD_LIBRARY_PATH
environment variable.
3. The
SHLIB_PATH environment variable.
4. The embedded path of the calling module (executable program or shared library) for libraries
named in calls to
dlopen(), dlopene(),ordlgetfileinfo()
. For dependent libraries,
the embedded path of the library that named it as a dependent is used.
5. The standard library path.
6. The current working directory. (This is only for libraries named in calls to
dlopen(), dlo-
pene(), and dlgetfileinfo()
, not their dependent libraries.)
(See dld.so (5) for additional information on search paths and options that can change the order described
above.)
Any combination of these paths may be disabled by setting flags to one or more of the following flag
values OR’ed together. If the following value is set, the dynamic loader does not search the specified loca-
tion:
RTLD_FLAG_DISABLE_DYNAMIC_PATH
Directories specified in the dynamic search path.
RTLD_FLAG_DISABLE_LD_LIBRARY_PATH
Directories specified in the LD_LIBRARY_PATH environment
variable.
RTLD_FLAG_DISABLE_SHLIB_PATH
Directories specified in the SHLIB_PATH environment vari-
able.
RTLD_FLAG_DISABLE_EMBEDDED_PATH
Directories specified in the embedded path.
RTLD_FLAG_DISABLE_STD_PATH Standard library directory.
RTLD_FLAG_DISABLE_CWD_PATH Current working directory.
Multiple search paths can be disabled by OR’ing individual flags:
flags = RTLD_FLAG_DISABLE_STD_PATH | RTLD_FLAG_DISABLE_CWD_PATH
A single search path can be enabled by setting flags to the complement of the flag value that disables that
search path:
flags = ˜RTLD_FLAG_DISABLE_DYNAMIC_PATH
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (2 pages)