[issue2470] Need fixer for dl (removed) -> ctypes module

Martin v. Löwis report at bugs.python.org
Mon Mar 24 17:41:38 CET 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

In the simplest case, convert

import dl
libc = dl.open("libc.so.6")
iconv = libc.call("iconv_open", "ISO-8859-1", "ISO-8859-2")
print(iconv)

to

import ctypes
libc = ctypes.CDLL("libc.so.6")
iconv = libc.iconv_open("ISO-8859-1", "ISO-8859-2")
print(iconv)

Notice that <dlobject>.call has up to 11 arguments, the first one being
the function name.

Thomas, is it the case that all calls to dl.call can be converted to a
ctypes call without parameter conversion? dl supports these parameter
types:
- byte string, passed as char*
- integers, passed as int
- None, passed as NULL

----------
nosy: +theller

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2470>
__________________________________


More information about the Python-bugs-list mailing list