Hi group,
I'm playing with ctypes and using it to do regressions on some C code
that I compile as a shared library. Python is the testing framework.
This works nicely as long as I do not need the return value (i.e.
calling works as expected and parameters are passed correctly). The
return value
On Sat, 19 May 2012 11:30:46 +0200, Johannes Bauer wrote:
import ctypes
libc = ctypes.cdll.LoadLibrary(/lib64/libc-2.14.1.so)
print(libc.strchr(abcdef, ord(d)))
In 3.x, a string will be passed as a wchar_t*, not a char*. IOW, the
memory pointed to by the first argument to strchr() will
On 19/05/2012 10:30, Johannes Bauer wrote:
Even the example in the standard library fails:
import ctypes
libc = ctypes.cdll.LoadLibrary(/lib64/libc-2.14.1.so)
print(libc.strchr(abcdef, ord(d)))
Always returns 0.
I think there may be two problems with this code:
(1) You are using a 64-bit
On 19/05/12 13:20:24, Nobody wrote:
On Sat, 19 May 2012 11:30:46 +0200, Johannes Bauer wrote:
import ctypes
libc = ctypes.cdll.LoadLibrary(/lib64/libc-2.14.1.so)
print(libc.strchr(abcdef, ord(d)))
In 3.x, a string will be passed as a wchar_t*, not a char*. IOW, the
memory pointed to by