Name

ffi:clines — Insert C declarations and definitions

Special form

(ffi:cline c-code*)

c-codeOne or more strings with C definitions. Not evaluated
returnsNo value.

Description

This special form inserts C code directly in the file that results from compiling lisp sources. Contrary to ffi:c-inline, this function may have no executable statements, accepts no input value and returnsn no value.

The main use of FFI:CLINES is to declare or define C variables and functions that are going to be used later in other FFI statements.

FFI:CLINES is a special form that can only be used in lisp compiled files as a toplevel form. Other uses will lead to an error being signaled, either at compilation time or when loading the file.

Examples

In this example the FFI:CLINES statement is required to get access to the C function cos()

(ffi:clines "#include <math.h>")
(defun cos (x)
  (ffi:c-inline (x) (:double) :double "cos(#0)" :on-liner t))