The dl module defines an interface to the dlopen()
function, which is the most common interface on Unix
platforms for handling dynamically linked libraries. It allows the program to call arbitrary
functions in such a library.
Note: This module will not work unless
== sizeof(long) == sizeof(char *) If this is not the case, SystemError
will be raised on import.
The dl module defines the following function:
- Open a shared object file, and return a handle. Mode signifies late binding (RTLD_LAZY) or immediate binding (RTLD_NOW).
Default is RTLD_LAZY. Note that some systems do not support RTLD_NOW.
Return value is a dlobject.
The dl module defines the following constants:
- Useful as an argument to open().
- Useful as an argument to open(). Note that on systems which do
not support immediate binding, this constant will not appear in the module. For maximum
portability, use hasattr() to determine if the system supports
The dl module defines the following exception:
- exception error
- Exception raised when an error has occurred inside the dynamic loading and linking
>>> import dl, time
>>> a.call('time'), time.time()
This example was tried on a Debian GNU/Linux system, and is a good example of the fact that
using this module is usually a bad alternative.