dlopen()

gain access to an executable object file 

Function


SYNOPSIS

#include <dlfcn.h>

void *dlopen(const char *file, int mode);


DESCRIPTION

dlopen() makes an executable object file specified by file available to the calling program. A successful dlopen() returns a handle for use in subsequent calls to dlsym() and dlclose(). The value of this handle should not be interpreted in any way by the caller. Only a single copy of the object file is brought into the address space, even if dlopen() is invoked multiple times in reference to the file, and even if different path names are used to reference the file.


PARAMETERS

file 

Specifies the object file to load. If file is not an absolute path, an implementation-defined algorithm is used to locate the file. If file is NULL, dlopen() provides a handle to the calling program itself.

mode 

Specifies the mode in which symbols should be bound. This may be either RTLD_LAZY or RTLD_NOW. These values are interpreted identically; symbols are always bound at load time. Both are recognized for maximum source compatibility, since there is no operational difference.


RETURN VALUES

On success, dlopen() returns a pointer which can be passed in subsequent calls to dlsym() and dlclose(). It returns a NULL on return. More detailed diagnostic information is available through the dlerror() function.


CONFORMANCE

UNIX 98, with exceptions.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

dlopen() is implemented as a pass-through to the Win32 function LoadLibrary(), and hence does not have all of the features available on some UNIX platforms. The modes RTLD_LAZY and RTLD_NOW are interpreted identically, and the modifiers RTLD_GLOBAL and RTLD_LOCAL specified in UNIX 98 are ignored (the Windows behavior is always equivalent to RTLD_NOW|RTLD_LOCAL). Please refer to the Win32 online documentation for more detailed information, in particular, the search order used if name is not an absolute path.


AVAILABILITY

MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
dlclose(), dlerror(), dlsym()


MKS Toolkit 9.2 Documentation Build 16.