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

11.1 Defining a library

Almost all foreign code you might want to access exists in some kind of shared library. The meaning of shared library varies among platforms, but for our purposes, we will consider it to include .so files on UNIX, frameworks on Darwin (and derivatives like Mac OS X), and .dll files on Windows.

Bringing one of these libraries into the Lisp image is normally a two-step process.

  1. Describe to CFFI how to load the library at some future point, depending on platform and other factors, with a define-foreign-library top-level form.
  2. Load the library so defined with either a top-level use-foreign-library form or by calling the function load-foreign-library.

See Loading foreign libraries, for a working example of the above two steps.