[GRASS-dev] Howto use a Python function as error handler in libgis

Sören Gebbert soerengebbert at googlemail.com
Sun Feb 15 15:13:26 PST 2015


Hi Glynn,
thanks a lot, that solved the issue.

Best regards
Soeren

2015-02-14 4:10 GMT+01:00 Glynn Clements <glynn at gclements.plus.com>:
>
> Sören Gebbert wrote:
>
>> Dear developers,
>> i am trying to register a Python function as error handler callback
>> using ctypes in libgis.
>> I use this code in the temporal framework:
>>
>>
>> {{{
>> def error_handler(data):
>>     pass
>>
>> CALLBACK = CFUNCTYPE(None, c_void_p)
>
> AFAICT, this needs to be:
>
>         CALLBACK = CFUNCTYPE(c_void_p, c_void_p)
>
> For callbacks, ctypesgen converts any return type which isn't a
> primitive C type to c_void_p. And None isn't a primitive C type.
>
> --
> Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list