Foreign functions made easy

Latest News

December 2007

Since starting this project, I've found other similar projects that are generally further along. I'll keep the current c2ffi code here for the record but there will probably not be any/much more development. I recommend checking out the following instead:

"Verrazano is a bindings generator targetting Common Lisp. It is designed to have robust support for C and C++ header files, by using GCC-XML as its parser, and to be easily retargettable to a number of different foreign function interfaces."
ffigen for Clozure Common Lisp
Clozure Common Lisp (previously known as OpenMCL) has an FFI system that uses automatically generated "interface databases" in place of the FFI declarations as in CFFI and UFFI. The program for generating these interfaces, ffigen, is available from Clozure's testing ftp site.
"SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages." SWIG now apparently supports CFFI, UFFI, CLISP and ACL.


This project aims to simplify the process of calling foreign C functions from Common Lisp programs. Specifically, foreign function interface definitions are generated automatically by parsing C header files.

Currently full functionality is only available in OpenMCL using CFFI. The plan is to make it portable to other Lisps, as well as generating UFFI definitions in addition to CFFI.


There is Tinaa-generated documentation available. The most important function is generate-ffi-for-files:

( generate-ffi-for-files < h-files > &key < generator-class > < gcc-options > < in-package > )


  1. CMake: Required by GCC-XML for building. Binaries available.
  2. GCC-XML: This is a patched GCC compiler that formats output from the C/C++ preprocessor as XML. c2ffi parses this XML instead of the raw C files. Please get GCC-XML via CVS, as the 0.6.0 release on their site is very old and incompatible with c2ffi:
    • cvs -d login
      (Press enter when prompted for a password.)
    • cvs -d co gccxml
    • cd gccxml
    • cmake .
    • make
    • sudo make install
  3. The following can be installed by asdf-install:


Mailing Lists


There is a Darcs repository for this project.

Please mail the mailing list with comments, patches, bug reports, etc.

Valid XHTML 1.0 Strict