Message94183
You are using `CFUNCTYPE` wrong. `CFUNCTYPE` returns a type which will
take a *Python function* (or an address of a function as integer). You
provide `lib.get_message` as Python function, which is a wrapper object
for the C function. By default, ctypes assumes an int as return type for
C functions. On your platform, the size of an int is not the same as the
size of a pointer. Therefore, the return value is truncated. You call
the CFUNCTION which then calls `lib.get_message` which returns the
truncated pointer as integer and then ctypes tries to make a `c_char_p`
out of the integer which segfaults because it's truncated.
I think what you are really looking for is ``lib.get_message.restype =
c_char_p``. |
|
Date |
User |
Action |
Args |
2009-10-17 17:10:27 | Trundle | set | recipients:
+ Trundle, theller, creachadair |
2009-10-17 17:10:27 | Trundle | set | messageid: <1255799427.7.0.452876793669.issue7160@psf.upfronthosting.co.za> |
2009-10-17 17:10:26 | Trundle | link | issue7160 messages |
2009-10-17 17:10:25 | Trundle | create | |
|