Hi!
 
Recently i've made a project to use graphviz from lisp code through cffi (cl-graphviz at http://common-lisp.net). In the process i used the cffi generator of SWIG. It was not perfect so i've taken a look at the source which is in c++. Then i gave up early... :)
 
And the idea: the CFFI/SWIG integration could be done in a different philosophy, where SWIG were used only as a c++ parser and the CFFI generator would be lisp code walking the C side parsed representation (using CFFI).
 
The idea is trollish, because i did not invest enough time to see the big picture, but the generated file had serious trouble with statements like #define FOO (1<<2)|(1<<3). The generator (written in C++) was trying to interpret it with not so much luck. It would be simpler in lisp, and then you could also generate the project specific lisp-side API right on.
 
The problem in general is not simple, because the value in a #define is a plain string, and it's sci-fi to start a C++ parser on that sniplet and walk the AST. In normal circumstances (c++ compiler) that define would go away in the preprocessor stage, but in an FFI you want to use the named values from lisp.

Enough trolling for now, and thanks for all the work on CFFI, it's great!
 
- attila

(alias 101 on irc &no 'its not lisp code :)