diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-24 06:22:57 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-03-24 06:22:57 (GMT) |
commit | 6cf49cf10689bf2ff23fff05928daa23ecdf6fc2 (patch) | |
tree | f98ace06aafb9ce7005beb8b3dec94bfec382739 /Doc | |
parent | e7789b186d640ee00e5709fcfbeca43780d379e4 (diff) | |
download | cpython-6cf49cf10689bf2ff23fff05928daa23ecdf6fc2.zip cpython-6cf49cf10689bf2ff23fff05928daa23ecdf6fc2.tar.gz cpython-6cf49cf10689bf2ff23fff05928daa23ecdf6fc2.tar.bz2 |
Remove the dl module per PEP 3108.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/dl.rst | 108 | ||||
-rw-r--r-- | Doc/library/sys.rst | 6 | ||||
-rw-r--r-- | Doc/library/unix.rst | 1 |
3 files changed, 3 insertions, 112 deletions
diff --git a/Doc/library/dl.rst b/Doc/library/dl.rst deleted file mode 100644 index de641e3..0000000 --- a/Doc/library/dl.rst +++ /dev/null @@ -1,108 +0,0 @@ - -:mod:`dl` --- Call C functions in shared objects -================================================ - -.. module:: dl - :platform: Unix - :synopsis: Call C functions in shared objects. -.. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il> - -The :mod:`dl` module defines an interface to the :cfunc:`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. - -.. warning:: - - The :mod:`dl` module bypasses the Python type system and error handling. If - used incorrectly it may cause segmentation faults, crashes or other incorrect - behaviour. - -.. note:: - - This module will not work unless ``sizeof(int) == sizeof(long) == sizeof(char - *)`` If this is not the case, :exc:`SystemError` will be raised on import. - -The :mod:`dl` module defines the following function: - - -.. function:: open(name[, mode=RTLD_LAZY]) - - Open a shared object file, and return a handle. Mode signifies late binding - (:const:`RTLD_LAZY`) or immediate binding (:const:`RTLD_NOW`). Default is - :const:`RTLD_LAZY`. Note that some systems do not support :const:`RTLD_NOW`. - - Return value is a :class:`dlobject`. - -The :mod:`dl` module defines the following constants: - - -.. data:: RTLD_LAZY - - Useful as an argument to :func:`open`. - - -.. data:: RTLD_NOW - - Useful as an argument to :func:`open`. Note that on systems which do not - support immediate binding, this constant will not appear in the module. For - maximum portability, use :func:`hasattr` to determine if the system supports - immediate binding. - -The :mod:`dl` module defines the following exception: - - -.. exception:: error - - Exception raised when an error has occurred inside the dynamic loading and - linking routines. - -Example:: - - >>> import dl, time - >>> a=dl.open('/lib/libc.so.6') - >>> a.call('time'), time.time() - (929723914, 929723914.498) - -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. - - -.. _dl-objects: - -Dl Objects ----------- - -Dl objects, as returned by :func:`open` above, have the following methods: - - -.. method:: dl.close() - - Free all resources, except the memory. - - -.. method:: dl.sym(name) - - Return the pointer for the function named *name*, as a number, if it exists in - the referenced shared object, otherwise ``None``. This is useful in code like:: - - >>> if a.sym('time'): - ... a.call('time') - ... else: - ... time.time() - - (Note that this function will return a non-zero number, as zero is the *NULL* - pointer) - - -.. method:: dl.call(name[, arg1[, arg2...]]) - - Call the function named *name* in the referenced shared object. The arguments - must be either Python integers, which will be passed as is, Python strings, to - which a pointer will be passed, or ``None``, which will be passed as *NULL*. - Note that strings should only be passed to functions as :ctype:`const char\*`, - as Python will not like its string mutated. - - There must be at most 10 arguments, and arguments not given will be treated as - ``None``. The function's return value must be a C :ctype:`long`, which is a - Python integer. - diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 02a1d20..085ba64 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -304,7 +304,7 @@ always available. .. function:: getdlopenflags() Return the current value of the flags that are used for :cfunc:`dlopen` calls. - The flag constants are defined in the :mod:`dl` and :mod:`DLFCN` modules. + The flag constants are defined in the :mod:`ctypes` and :mod:`DLFCN` modules. Availability: Unix. @@ -587,8 +587,8 @@ always available. the interpreter loads extension modules. Among other things, this will enable a lazy resolving of symbols when importing a module, if called as ``sys.setdlopenflags(0)``. To share symbols across extension modules, call as - ``sys.setdlopenflags(dl.RTLD_NOW | dl.RTLD_GLOBAL)``. Symbolic names for the - flag modules can be either found in the :mod:`dl` module, or in the :mod:`DLFCN` + ``sys.setdlopenflags(ctypes.RTLD_GLOBAL)``. Symbolic names for the + flag modules can be either found in the :mod:`ctypes` module, or in the :mod:`DLFCN` module. If :mod:`DLFCN` is not available, it can be generated from :file:`/usr/include/dlfcn.h` using the :program:`h2py` script. Availability: Unix. diff --git a/Doc/library/unix.rst b/Doc/library/unix.rst index b60af0f..1b1592e 100644 --- a/Doc/library/unix.rst +++ b/Doc/library/unix.rst @@ -17,7 +17,6 @@ of it. Here's an overview: spwd.rst grp.rst crypt.rst - dl.rst termios.rst tty.rst pty.rst |