Previous Section Next Section Table of Contents Glossary Index

Chapter 13. The Foreign-Function Interface

13.4. The Interface Database

13.4.1. Overview

CCL uses a set of database files which contain foreign type, record, constant, and function definitions derived from the operating system's header files, be that Linux or Darwin. An archive containing these database files (and the shell scripts which were used in their creation) is available; see the Distributions page for information about obtaining current interface database files.

Not surprisingly, different platforms use different database files.

CCL defines reader macros that consult these databases:

  • #$foo looks up the value of the constant definition of foo

  • #_foo looks up the foreign function definition for foo

In both cases, the symbol foo is interned in the "OS" package. The #$ reader macro has the side-effect of defining foo as a constant (as if via DEFCONSTANT); the #_ reader macro has the side effect of defining foo as a macro which will expand into an (EXTERNAL-CALL form.)

It's important to remember that the side-effect happens when the form containing the reader macro is read. Macroexpansion functions that expand into forms which contain instances of those reader macros don't do what one might think that they do, unless the macros are expanded in the same lisp session as the reader macro was read in.

In addition, references to foreign type, structure/union, and field names (when used in the RREF/PREF and RLET macros) will cause these database files to be consulted.

Since the CCL sources contain instances of these reader macros (and references to foreign record types and fields), compiling CCL from those sources depends on the ability to find and use (see Section 3.6, “Building the Heap Image”).

13.4.2. Other issues:

  • CCL now preserves the case of external symbols in its database files. See Case-sensitivity of foreign names in CCL for information about case in foreign symbol names.

  • The Linux databases are derived from a somewhat arbitrary set of Linux header files. Linux is enough of a moving target that it may be difficult to define a standard, reference set of interfaces from which to derive a standard, reference set of database files.This seems to be less of an issue with Darwin and FreeBSD.

For information about building the database files, see Section 13.7, “The Interface Translator”.


Previous Section Next Section Table of Contents Glossary Index