1 Introduction

CFFI is the Common Foreign Function Interface for ANSI
Common Lisp systems. By foreign function we mean a function
written in another programming language and having different data and
calling conventions than Common Lisp, namely, C. CFFI allows you
to call foreign functions and access foreign variables, all without
leaving the Lisp image.

We consider this manual ever a work in progress. If you have
difficulty with anything CFFI-specific presented in the manual,
please contact the developers with
details.

Motivation

CFFI's primary role in any image is to mediate between Lisp
developers and the widely varying FFIs present in the
various Lisp implementations it supports. With CFFI, you can
define foreign function interfaces while still maintaining portability
between implementations. It is not the first Common Lisp package with
this objective; however, it is meant to be a more malleable framework
than similar packages.

Design Philosophy

Pointers do not carry around type information. Instead, type
information is supplied when pointers are dereferenced.

A type safe pointer interface can be developed on top of an
untyped one. It is difficult to do the opposite.

Functions are better than macros. When a macro could be used
for performance, use a compiler-macro instead.