February 20, 2006
SWIG and CFFI

William Wray, National Ready Mix

SWIG, the automatic multi-language foreign interface generator, supports CFFI as of version 1.3.28. ACL, CLISP and UFFI were already supported.

I've used SWIG with Python to create nice interfaces to C libraries, but it really only gets you about 30% of the way there. Another 30% is writing type maps and things within the SWIG framework, and the last 40% is hand coding. I'm sure the exact proportions depend on the circumstances, but I've heard other Pythoneers say they prefer hand-rolling interfaces to using SWIG, so I don't think it's too far from typical.

Posted by jjwiseman at February 20, 2006 11:14 AM
Comments

I've recently generated wrappers for the SDL library with CFFI and SWIG. I'd say we got to nearer 95% of automatically generated and 5% hackery.

The developers of CFFI are very active and fixed several things to get me from 70% to that figure.

Justin

Posted by: Justin on February 28, 2006 11:19 AM

For me, the problem has been that I don't really understand or know SWIG yet; and whenever I'm in a hurry, it's usually less hard to just do the bindings by hand (with a good editor) than to try to learn SWIG.
If I knew or understood SWIG, maybe I'd use it more often.

Posted by: Sunnan on March 23, 2006 06:20 AM
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?