dlopen

Loads and provides access to a shared library.

Library:LibC
Classification:POSIX
Service:Library

Syntax

  #include <dlfcn.h> 
   
  void *dlopen (
     const char   *path,
     int           mode);
  

Parameters

path

(IN) Points to the path and name of the object.

mode

(IN) Specifies how to open the object. You can OR one of the first two flags with either RTLD_GLOBAL or RTLD_LOCAL. This value can be ORed to RTLD_MULTIPLE:

Flag

Value

Description

RTLD_LAZY

0x01

NetWare mode of operation. Currently ignored.

RTLD_NOW

0x02

Ignored.

RTLD_GLOBAL

0x04

Load in the kernel. Currently ignored.

RTLD_LOCAL

0x08

Load in protected address space. Currently ignored.

RTLD_MULTIPLE

0x10

Force-load multiple times. This is a NetWare specific flag.

Return Values

If successful, returns a handle to the object. Otherwise, returns NULL and sets a value for dlerror.

Remarks

The dlopen function returns a handle, which you can use on subsequent calls to dlsym to dynamically import a symbol.

If the path parameter is NULL, dlopen returns a handle to a global symbol object which can be used to request symbols that do not belong to a specific named library.

For sample code, see DLFcn.c.

See Also