Thomas Heller <[EMAIL PROTECTED]> added the comment:

Thomas Heller schrieb:
> Thomas Heller <[EMAIL PROTECTED]> 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)
>> 

Currently, in py3k, ctypes only passed bytes objects as char*; so
the strings should be translated to bytes literals:

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

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2470>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to