Next: , Previous: , Up: Top   [Contents][Index]

13 The Groveller

CFFI-Grovel is a tool which makes it easier to write CFFI declarations for libraries that are implemented in C. That is, it grovels through the system headers, getting information about types and structures, so you don’t have to. This is especially important for libraries which are implemented in different ways by different vendors, such as the UNIX/POSIX functions. The CFFI declarations are usually quite different from platform to platform, but the information you give to CFFI-Grovel is the same. Hence, much less work is required!

If you use ASDF, CFFI-Grovel is integrated, so that it will run automatically when your system is building. This feature was inspired by SB-Grovel, a similar SBCL-specific project. CFFI-Grovel can also be used without ASDF.

13.1 Building FFIs with CFFI-Grovel

CFFI-Grovel uses a specification file (*.lisp) describing the features that need groveling. The C compiler is used to retrieve this data and write a Lisp file (*.cffi.lisp) which contains the necessary CFFI definitions to access the variables, structures, constants, and enums mentioned in the specification.

CFFI-Grovel provides an ASDF component for handling the necessary calls to the C compiler and resulting file management.