Hi Eric,
On 8 June 2015 at 10:18, <
erik.j...@conceptive.be> wrote:
> 1. When a C function returns a struct containing function pointers,
> how would one call the functions to which the pointers point.
> The signature of the function is known (...)
It should work out of box: if "p" is a cdata pointer to a struct where
the field "myfunc" is a function pointer, then you can say
"p.myfunc(1, 2, 3)".
> 2. As the cdef function does not support all C macro constructs,
> would it be an option to have the gcc C preprocessor process
> header files first, before feeding them to cffi, or is this a futile
> exercise ?
If you have a complex header situation, it is highly recommended to
use the "API mode" instead of the "ABI mode". See
http://cffi.readthedocs.org/en/latest/overview.html . You need to
paste the header and edit it a bit, notably to replace some real
definitions with the string ``...``, but the result is much closer to
what you'd do in C: the compiler is used, not to preprocess some
headers but to really compile an extension module.
A bientôt,
Armin.