This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Trundle
Recipients Trundle, creachadair, theller
Date 2009-10-17.17:10:25
SpamBayes Score 3.48848e-08
Marked as misclassified No
Message-id <>
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 = 
Date User Action Args
2009-10-17 17:10:27Trundlesetrecipients: + Trundle, theller, creachadair
2009-10-17 17:10:27Trundlesetmessageid: <>
2009-10-17 17:10:26Trundlelinkissue7160 messages
2009-10-17 17:10:25Trundlecreate