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


4 An Introduction to Foreign Interfaces and CFFI

Users of many popular languages bearing semantic similarity to Lisp, such as Perl and Python, are accustomed to having access to popular C libraries, such as GTK, by way of “bindings”. In Lisp, we do something similar, but take a fundamentally different approach. This tutorial first explains this difference, then explains how you can use CFFI, a powerful system for calling out to C and C++ and access C data from many Common Lisp implementations.

The concept can be generalized to other languages; at the time of writing, only CFFI’s C support is fairly complete. Therefore, we will interchangeably refer to foreign functions and foreign data, and “C functions” and “C data”. At no time will the word “foreign” carry its usual, non-programming meaning.

This tutorial expects you to have a working understanding of both Common Lisp and C, including the Common Lisp macro system.


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