Issue #102 resolved

C functions with struct or union args break CFFI introspection

Isaac Freeman
created an issue

If a C function is defined with a struct or union as an argument, the verifier wraps the CData object in a closure named newfunc. Attempting to do ffi.typeof(cfunc) raises a TypeError.

I've found where in the CFFI code this happens and I thought maybe just putting a @functools.wraps(oldfunc) might clear it up, but it doesn't work. I've tried looking deeper for a way to fix this but a lot of this is way over my head.

Maybe just need to add a case to FFI.typeof()? Not sure how that would work though, because even digging around in the func_closure of the newfunc doesn't seem to have anything that you could pull the info from... Maybe need to add some attributes to the nested function object in _make_struct_wrapper? I don't know...

Comments (4)

  1. Log in to comment