[GRASS-dev] Howto use a Python function as error handler in libgis
Glynn Clements
glynn at gclements.plus.com
Fri Feb 13 19:10:48 PST 2015
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