C Callback Function using ctypes

OJ olejl77 at gmail.com
Sat Mar 26 05:57:04 EDT 2011


On 26 March 2011 12:55, OJ <olejl77 at gmail.com> wrote:
>> 1. Use c_char_p instead of POINTER(c_char).
>> 2. Use msg.value to obtain a Python string from the pointer.
>>
>
> If I change to c_char_p, my program segfaults.
>
> If I use msg.value, I get this error message:
> Traceback (most recent call last):
>  File "_ctypes/callbacks.c", line 295, in 'calling callback function'
>  File "./core.py", line 54, in DebugMessage
>    print lvl, msg.value
> AttributeError: 'LP_c_char' object has no attribute 'value'
>



More information about the Python-list mailing list