[cffi-devel] requesting help debugging error in libclang bindings

Luís Oliveira luismbo at gmail.com
Sun Jul 1 22:38:14 UTC 2012


On Sat, Jun 30, 2012 at 6:15 PM, Eric Schulte <eric.schulte at gmx.com> wrote:
>      (cffi:defcstruct CXCursor
>        (kind CXCursorKind)
>        (xdata :int)
>        (data :pointer))
>      ;; ...
>      (cffi:defcfun ("clang_getTranslationUnitCursor" clang_getTranslationUnitCursor)
>          CXCursor
>        (arg0 :pointer))

IIUC, this is the problem: clang_getTranslationUnitCursor() returns a
structure by value, but SWIG has erroneously declared it to return a
structure by reference. (If you have the chance, please report this
bug to the SWIG maintainers, or if there's no one maintaining SWIG's
CFFI backend, you can report it at CFFI's bugtracker.)

If you grab CFFI from its git repository, you'll find a new system
called "cffi-libffii" which implements the passing of structures by
value. (The syntax in this case would be (defcfun ... (:struct
CXCursor) ...).) Let us know if you have trouble using it.

HTH,

-- 
Luís Oliveira
http://r42.eu/~luis/




More information about the cffi-devel mailing list