Need support for import/extend cdef definitions from another library
When libB and libC depend on LibA and structures defined in libA writing CFFI wrappers is trouble some.
Data types and structures have to be redefined in the cdef of libA, libB and libC which is redundant.
The more ugly problem is that if I created an object using libA I cannot pass/use it with libB or libC without typecasting.
structA = libA.ffi.new('struct structA *') # The following causes an error saying 'struct structA *' # is needed but 'struct structA *' is provided. libB.funcB(structA) # I have to do a typecast to make it work which is ugly and # could also be risky coding libB.funcB(libB.ffi.cast('struct structA *',structA))
The solution discussed in the mailing list is to implement something like
libB.py -------- import libA ffi.extend(libA.ffi) ffi.cdef(''' libB cdef content ''')
style operation that can import the cdefs from another library. This will address both the above problem as well as eliminate the need for duplicate definition of data types in modular libraries.