cffi

API Reference

cffi

The Common Foreign Function Interface

CFFI-SYS

  • Function CANONICALIZE-SYMBOL-NAME-CASE (name)
  • Type FOREIGN-POINTER
  • Function POINTERP (ptr)
    Return true if PTR is a foreign pointer.
  • Function POINTER-EQ (ptr1 ptr2)
    Return true if PTR1 and PTR2 point to the same address.
  • Function NULL-POINTER
    Construct and return a null pointer.
  • Function NULL-POINTER-P (ptr)
    Return true if PTR is a null pointer.
  • Function INC-POINTER (ptr offset)
    Return a pointer pointing OFFSET bytes past PTR.
  • Function MAKE-POINTER (address)
    Return a pointer pointing to ADDRESS.
  • Function POINTER-ADDRESS (ptr)
    Return the address pointed to by PTR.
  • Function %FOREIGN-ALLOC (size)
    Allocate SIZE bytes on the heap and return a pointer.
  • Function FOREIGN-FREE (ptr)
    Free a PTR allocated by FOREIGN-ALLOC.
  • Macro WITH-FOREIGN-POINTER ((var size &optional size-var) &body body)
    Bind VAR to SIZE bytes of foreign memory during BODY. The pointer in VAR is invalid beyond the dynamic extent of BODY, and may be stack-allocated if supported by the implementation. If SIZE-VAR is supplied, it will be bound to SIZE during BODY.
  • Function MAKE-SHAREABLE-BYTE-VECTOR (size)
    Create a Lisp vector of SIZE bytes can passed to WITH-POINTER-TO-VECTOR-DATA.
  • Macro WITH-POINTER-TO-VECTOR-DATA ((ptr-var vector) &body body)
    Bind PTR-VAR to a foreign pointer to the data in VECTOR.
  • Function %MEM-REF (ptr type &optional (offset 0))
  • Function %MEM-SET (value ptr type &optional (offset 0))
  • Function %FOREIGN-TYPE-SIZE (type-keyword)
    Return the size in bytes of a foreign type.
  • Function %FOREIGN-TYPE-ALIGNMENT (type-keyword)
    Return the alignment in bytes of a foreign type.
  • Macro %FOREIGN-FUNCALL (name args &key library convention)
    Perform a foreign function call, document it more later.
  • Macro %FOREIGN-FUNCALL-POINTER (ptr args &key convention)
    Funcall a pointer to a foreign function.
  • Macro %DEFCALLBACK (name rettype arg-names arg-types body &key convention)
  • Function %CALLBACK (name)
  • Function %LOAD-FOREIGN-LIBRARY (name path)
    Load a foreign library.
  • Function %CLOSE-FOREIGN-LIBRARY (handle)
    Closes a foreign library.
  • Function NATIVE-NAMESTRING (pathname)
  • Function %FOREIGN-SYMBOL-POINTER (name library)
    Returns a pointer to a foreign symbol NAME.

CFFI

  • Variable *FOREIGN-LIBRARY-DIRECTORIES*
    (if (alexandria.0.dev:featurep :darwin)
        '((cffi::explode-path-environment-variable "ld_library_path")
          (cffi::explode-path-environment-variable "dyld_library_path")
          (uiop/os:getcwd) (cffi::darwin-fallback-library-path))
        'nil)
    List onto which user-defined library paths can be pushed.
  • Variable *DARWIN-FRAMEWORK-DIRECTORIES*
    '((cffi::explode-path-environment-variable "dyld_framework_path")
      (cffi::fallback-darwin-framework-directories))
    List of directories where Frameworks are searched for.
  • Class FOREIGN-LIBRARY
    NAME   Accessor: FOREIGN-LIBRARY-NAME
    TYPE
    SPEC
    OPTIONS
    HANDLE   Accessor: FOREIGN-LIBRARY-HANDLE
    PATHNAME
  • Function FOREIGN-LIBRARY-TYPE (lib)
  • Function FOREIGN-LIBRARY-PATHNAME (lib)
  • Function FOREIGN-LIBRARY-LOADED-P (lib)
  • Function LIST-FOREIGN-LIBRARIES (&key (loaded-only t) type)
    Return a list of defined foreign libraries. If LOADED-ONLY is non-null only loaded libraries are returned. TYPE restricts the output to a specific library type: if NIL all libraries are returned.
  • Macro DEFINE-FOREIGN-LIBRARY (name-and-options &body pairs)
    Defines a foreign library NAME that can be posteriorly used with the USE-FOREIGN-LIBRARY macro.
  • Condition LOAD-FOREIGN-LIBRARY-ERROR  (SIMPLE-ERROR)
  • Function LOAD-FOREIGN-LIBRARY (library &key search-path)
    Loads a foreign LIBRARY which can be a symbol denoting a library defined through DEFINE-FOREIGN-LIBRARY; a pathname or string in which case we try to load it directly first then search for it in *FOREIGN-LIBRARY-DIRECTORIES*; or finally list: either (:or lib1 lib2) or (:framework <framework-name>).
  • Macro USE-FOREIGN-LIBRARY (name)
  • Function CLOSE-FOREIGN-LIBRARY (library)
    Closes a foreign library.
  • Function RELOAD-FOREIGN-LIBRARIES (&key (test #'foreign-library-loaded-p))
    (Re)load all currently loaded foreign libraries.
  • Macro DEFINE-PARSE-METHOD (name lambda-list &body body)
    Define a type parser on NAME and lists whose CAR is NAME.
  • Generic-Function FOREIGN-TYPE-ALIGNMENT (foreign-type)
    Return the structure alignment in bytes of a foreign type.
  • Generic-Function FOREIGN-TYPE-SIZE (foreign-type)
    Return the size in bytes of a foreign type.
  • Method FOREIGN-TYPE-SIZE (type)
    Return the size in bytes of a foreign type.
  • Method FOREIGN-TYPE-ALIGNMENT ((type foreign-built-in-type))
    Return the alignment of a built-in type.
  • Method FOREIGN-TYPE-SIZE ((type foreign-built-in-type))
    Return the size of a built-in type.
  • Variable *BUILT-IN-FOREIGN-TYPES*
    nil
  • Method FOREIGN-TYPE-SIZE ((type foreign-struct-type))
    Return the size in bytes of a foreign structure type.
  • Method FOREIGN-TYPE-ALIGNMENT ((type foreign-struct-type))
    Return the alignment requirements for this struct.
  • Method FOREIGN-TYPE-ALIGNMENT ((type foreign-type-alias))
    Return the alignment of a foreign typedef.
  • Method FOREIGN-TYPE-SIZE ((type foreign-type-alias))
    Return the size in bytes of a foreign typedef.
  • Generic-Function TRANSLATE-TO-FOREIGN (value type)
  • Generic-Function TRANSLATE-INTO-FOREIGN-MEMORY (value type pointer)
    Translate the Lisp value into the foreign memory location given by pointer. Return value is not used.
  • Generic-Function TRANSLATE-FROM-FOREIGN (value type)
  • Generic-Function FREE-TRANSLATED-OBJECT (value type param)
  • Method FREE-TRANSLATED-OBJECT (value type param)
  • Method FREE-TRANSLATED-OBJECT (value type param)
  • Method FREE-TRANSLATED-OBJECT (value type param)
  • Generic-Function EXPAND-FROM-FOREIGN (value type)
  • Method EXPAND-FROM-FOREIGN (value (type translatable-foreign-type))
  • Generic-Function EXPAND-TO-FOREIGN (value type)
  • Method EXPAND-TO-FOREIGN (value type)
  • Method EXPAND-TO-FOREIGN (value type)
  • Method EXPAND-TO-FOREIGN (value type)
  • Method EXPAND-TO-FOREIGN (value (type translatable-foreign-type))
  • Method EXPAND-TO-FOREIGN (value (type translatable-foreign-type))
  • Generic-Function EXPAND-INTO-FOREIGN-MEMORY (value type ptr)
  • Method EXPAND-INTO-FOREIGN-MEMORY (value (type translatable-foreign-type) ptr)
  • Generic-Function EXPAND-TO-FOREIGN-DYN (value var body type)
  • Method EXPAND-TO-FOREIGN-DYN (value var body type)
  • Method EXPAND-TO-FOREIGN-DYN (value var body type)
  • Method EXPAND-TO-FOREIGN-DYN (value var body type)
  • Method EXPAND-TO-FOREIGN-DYN (value var body (type enhanced-foreign-type))
  • Method EXPAND-TO-FOREIGN-DYN (value var body (type enhanced-foreign-type))
  • Function CONVERT-TO-FOREIGN (value type)
  • Function CONVERT-FROM-FOREIGN (value type)
  • Function CONVERT-INTO-FOREIGN-MEMORY (value type ptr)
  • Function FREE-CONVERTED-OBJECT (value type param)
  • Method TRANSLATE-TO-FOREIGN (value (type enhanced-typedef))
  • Method TRANSLATE-INTO-FOREIGN-MEMORY (value (type enhanced-typedef) pointer)
  • Method TRANSLATE-FROM-FOREIGN (value (type enhanced-typedef))
  • Method FREE-TRANSLATED-OBJECT (value (type enhanced-typedef) param)
  • Method EXPAND-FROM-FOREIGN (value (type enhanced-typedef))
  • Method EXPAND-TO-FOREIGN (value (type enhanced-typedef))
  • Method EXPAND-TO-FOREIGN-DYN (value var body (type enhanced-typedef))
  • Method EXPAND-INTO-FOREIGN-MEMORY (value (type enhanced-typedef) ptr)
  • Macro DEFINE-FOREIGN-TYPE (name supers slots &rest options)
  • Macro DEFCTYPE (name base-type &optional documentation)
    Utility macro for simple C-like typedefs.
  • Variable *OTHER-BUILTIN-TYPES*
    '(:pointer :void)
    List of types other than integer or float built in to CFFI.
  • Variable *BUILT-IN-INTEGER-TYPES*
    (set-difference cffi:*built-in-foreign-types*
                    (append cffi::*possible-float-types*
                            cffi:*other-builtin-types*))
    List of integer types supported by CFFI.
  • Variable *BUILT-IN-FLOAT-TYPES*
    (set-difference cffi:*built-in-foreign-types*
                    (append cffi:*built-in-integer-types*
                            cffi:*other-builtin-types*))
    List of real float types supported by CFFI.
  • Macro INCF-POINTER (place &optional (offset 1) &environment env)
  • Function MEM-REF (ptr type &optional (offset 0))
    Return the value of TYPE at OFFSET bytes from PTR. If TYPE is aggregate, we don't return its 'value' but a pointer to it, which is PTR itself.
  • Function MEM-AREF (ptr type &optional (index 0))
    Like MEM-REF except for accessing 1d arrays.
  • Method TRANSLATE-INTO-FOREIGN-MEMORY (value (type foreign-pointer-type) pointer)
  • Method TRANSLATE-INTO-FOREIGN-MEMORY (value (type foreign-built-in-type) pointer)
  • Function MEM-APTR (ptr type &optional (index 0))
    The pointer to the element.
  • Method FOREIGN-TYPE-SIZE ((type foreign-array-type))
  • Method FOREIGN-TYPE-ALIGNMENT ((type foreign-array-type))
  • Function FOREIGN-ALLOC (type &key (initial-element nil initial-element-p) (initial-contents nil initial-contents-p) (count 1 count-p) null-terminated-p)
    Allocate enough memory to hold COUNT objects of type TYPE. If INITIAL-ELEMENT is supplied, each element of the newly allocated memory is initialized with its value. If INITIAL-CONTENTS is supplied, each of its elements will be used to initialize the contents of the newly allocated memory.
  • Function LISP-ARRAY-TO-FOREIGN (array pointer array-type)
    Copy elements from a Lisp array to POINTER.
  • Function FOREIGN-ARRAY-TO-LISP (pointer array-type)
    Copy elements from ptr into a Lisp array. If POINTER is a null pointer, returns NIL.
  • Function FOREIGN-ARRAY-ALLOC (array array-type)
    Allocate a foreign array containing the elements of lisp array. The foreign array must be freed with foreign-array-free.
  • Function FOREIGN-ARRAY-FREE (ptr)
    Free a foreign array allocated by foreign-array-alloc.
  • Macro WITH-FOREIGN-ARRAY ((var lisp-array array-type) &body body)
    Bind var to a foreign array containing lisp-array elements in body.
  • Function FOREIGN-AREF (ptr array-type &rest indexes)
  • Function (setf FOREIGN-AREF) (value ptr array-type &rest indexes)
  • Method TRANSLATE-TO-FOREIGN (array (type foreign-array-type))
  • Method TRANSLATE-FROM-FOREIGN (pointer (type foreign-array-type))
  • Method FREE-TRANSLATED-OBJECT (pointer (type foreign-array-type) param)
  • Function FOREIGN-SLOT-NAMES (type)
    Returns a list of TYPE's slot names in no particular order.
  • Macro DEFCSTRUCT (name-and-options &body fields)
    Define the layout of a foreign structure.
  • Function FOREIGN-SLOT-POINTER (ptr type slot-name)
    Return the address of SLOT-NAME in the structure at PTR.
  • Function FOREIGN-SLOT-TYPE (type slot-name)
    Return the type of SLOT in a struct TYPE.
  • Function FOREIGN-SLOT-OFFSET (type slot-name)
    Return the offset of SLOT in a struct TYPE.
  • Function FOREIGN-SLOT-COUNT (type slot-name)
    Return the number of items in SLOT in a struct TYPE.
  • Function FOREIGN-SLOT-VALUE (ptr type slot-name)
    Return the value of SLOT-NAME in the foreign structure at PTR.
  • Macro WITH-FOREIGN-SLOTS ((vars ptr type) &body body)
    Create local symbol macros for each var in VARS to reference foreign slots in PTR of TYPE. Similar to WITH-SLOTS. Each var can be of the form: slot-name - in which case slot-name will be bound to the value of the slot or: (:pointer slot-name) - in which case slot-name will be bound to the pointer to that slot.
  • Macro DEFINE-C-STRUCT-WRAPPER (class-and-type supers &optional slots)
    Define a new class with CLOS slots matching those of a foreign struct type. An INITIALIZE-INSTANCE method is defined which takes a :POINTER initarg that is used to store the slots of a foreign object. This pointer is only used for initialization and it is not retained. CLASS-AND-TYPE is either a list of the form (class-name struct-type) or a single symbol naming both. The class will inherit SUPERS. If a list of SLOTS is specified, only those slots will be defined and stored.
  • Macro DEFCUNION (name-and-options &body fields)
    Define the layout of a foreign union.
  • Method FOREIGN-TYPE-ALIGNMENT (type)
    Return the alignment in bytes of a foreign type.
  • Macro WITH-FOREIGN-OBJECT ((var type &optional (count 1)) &body body)
    Bind VAR to a pointer to COUNT objects of TYPE during BODY. The buffer has dynamic extent and may be stack allocated.
  • Macro WITH-FOREIGN-OBJECTS (bindings &body body)
  • Method TRANSLATE-TO-FOREIGN (value (type foreign-type-wrapper))
  • Method TRANSLATE-FROM-FOREIGN (value (type foreign-type-wrapper))
  • Method TRANSLATE-TO-FOREIGN (value (type foreign-boolean-type))
  • Method TRANSLATE-FROM-FOREIGN (value (type foreign-boolean-type))
  • Method EXPAND-TO-FOREIGN (value (type foreign-boolean-type))
    Optimization for the :boolean type.
  • Method EXPAND-FROM-FOREIGN (value (type foreign-boolean-type))
    Optimization for the :boolean type.
  • Macro DEFCENUM (name-and-options &body enum-list)
    Define an foreign enumerated type.
  • Function FOREIGN-ENUM-KEYWORD-LIST (enum-type)
    Return a list of KEYWORDS defined in ENUM-TYPE.
  • Function FOREIGN-ENUM-VALUE (type keyword &key (errorp t))
    Convert a KEYWORD into an integer according to the enum TYPE.
  • Function FOREIGN-ENUM-KEYWORD (type value &key (errorp t))
    Convert an integer VALUE into a keyword according to the enum TYPE.
  • Method TRANSLATE-TO-FOREIGN (value (type foreign-enum))
  • Method TRANSLATE-INTO-FOREIGN-MEMORY (value (type foreign-enum) pointer)
  • Method TRANSLATE-FROM-FOREIGN (value (type foreign-enum))
  • Method EXPAND-TO-FOREIGN (value (type foreign-enum))
  • Macro DEFBITFIELD (name-and-options &body masks)
    Define an foreign enumerated type.
  • Function FOREIGN-BITFIELD-SYMBOL-LIST (bitfield-type)
    Return a list of SYMBOLS defined in BITFIELD-TYPE.
  • Function FOREIGN-BITFIELD-VALUE (type symbols)
    Convert a list of symbols into an integer according to the TYPE bitfield.
  • Function FOREIGN-BITFIELD-SYMBOLS (type value)
    Convert an integer VALUE into a list of matching symbols according to the bitfield TYPE.
  • Method TRANSLATE-TO-FOREIGN (value (type foreign-bitfield))
  • Method TRANSLATE-FROM-FOREIGN (value (type foreign-bitfield))
  • Method EXPAND-TO-FOREIGN (value (type foreign-bitfield))
  • Method EXPAND-FROM-FOREIGN (value (type foreign-bitfield))
  • Variable *DEFAULT-FOREIGN-ENCODING*
    :utf-8
    Default foreign encoding.
  • Function LISP-STRING-TO-FOREIGN (string buffer bufsize &key (start 0) end offset (encoding *default-foreign-encoding*))
  • Function FOREIGN-STRING-TO-LISP (pointer &key (offset 0) count (max-chars (1- array-total-size-limit)) (encoding *default-foreign-encoding*))
    Copy at most COUNT bytes from POINTER plus OFFSET encoded in ENCODING into a Lisp string and return it. If POINTER is a null pointer, NIL is returned.
  • Function FOREIGN-STRING-ALLOC (string &key (encoding *default-foreign-encoding*) (null-terminated-p t) (start 0) end)
    Allocate a foreign string containing Lisp string STRING. The string must be freed with FOREIGN-STRING-FREE.
  • Function FOREIGN-STRING-FREE (ptr)
    Free a foreign string allocated by FOREIGN-STRING-ALLOC.
  • Macro WITH-FOREIGN-STRING ((var-or-vars lisp-string &rest args) &body body)
    VAR-OR-VARS is not evaluated and should be a list of the form (VAR &OPTIONAL BYTE-SIZE-VAR) or just a VAR symbol. VAR is bound to a foreign string containing LISP-STRING in BODY. When BYTE-SIZE-VAR is specified then bind the C buffer size (including the possible null terminator(s)) to this variable.
  • Macro WITH-FOREIGN-STRINGS (bindings &body body)
    See WITH-FOREIGN-STRING's documentation.
  • Macro WITH-FOREIGN-POINTER-AS-STRING ((var-or-vars size &rest args) &body body)
    VAR-OR-VARS is not evaluated and should be a list of the form (VAR &OPTIONAL SIZE-VAR) or just a VAR symbol. VAR is bound to a foreign buffer of size SIZE within BODY. The return value is constructed by calling FOREIGN-STRING-TO-LISP on the foreign buffer along with ARGS.
  • Method TRANSLATE-TO-FOREIGN ((s string) (type foreign-string-type))
  • Method TRANSLATE-TO-FOREIGN (obj (type foreign-string-type))
  • Method TRANSLATE-FROM-FOREIGN (ptr (type foreign-string-type))
  • Method FREE-TRANSLATED-OBJECT (ptr (type foreign-string-type) free-p)
  • Method TRANSLATE-FROM-FOREIGN (value (type foreign-string+ptr-type))
  • Method TRANSLATE-INTO-FOREIGN-MEMORY ((object list) (type foreign-struct-type) p)
  • Method TRANSLATE-TO-FOREIGN (value (type foreign-struct-type))
  • Method TRANSLATE-FROM-FOREIGN (p (type foreign-struct-type))
  • Method FREE-TRANSLATED-OBJECT (ptr (type foreign-struct-type) freep)
  • Macro DEFINE-TRANSLATION-METHOD ((object type method) &body body)
    Define a translation method for the foreign structure type; 'method is one of :into, :from, or :to, meaning relation to foreign memory. If :into, the variable 'pointer is the foreign pointer. Note: type must be defined and loaded before this macro is expanded, and just the bare name (without :struct) should be specified.
  • Macro TRANSLATION-FORMS-FOR-CLASS (class type-class)
    Make forms for translation of foreign structures to and from a standard class. The class slots are assumed to have the same name as the foreign structure.
  • Macro FOREIGN-FUNCALL (name-and-options &rest args)
    Wrapper around %FOREIGN-FUNCALL that translates its arguments.
  • Macro FOREIGN-FUNCALL-POINTER (pointer options &rest args)
  • Generic-Function TRANSLATE-UNDERSCORE-SEPARATED-NAME (name)
  • Method TRANSLATE-UNDERSCORE-SEPARATED-NAME ((name symbol))
  • Method TRANSLATE-UNDERSCORE-SEPARATED-NAME ((name symbol))
  • Method TRANSLATE-UNDERSCORE-SEPARATED-NAME ((name symbol))
  • Method TRANSLATE-UNDERSCORE-SEPARATED-NAME ((name string))
  • Method TRANSLATE-UNDERSCORE-SEPARATED-NAME ((name string))
  • Method TRANSLATE-UNDERSCORE-SEPARATED-NAME ((name string))
  • Generic-Function TRANSLATE-CAMELCASE-NAME (name &key upper-initial-p special-words)
  • Method TRANSLATE-CAMELCASE-NAME ((name symbol) &key upper-initial-p special-words)
  • Method TRANSLATE-CAMELCASE-NAME ((name symbol) &key upper-initial-p special-words)
  • Method TRANSLATE-CAMELCASE-NAME ((name symbol) &key upper-initial-p special-words)
  • Method TRANSLATE-CAMELCASE-NAME ((name string) &key upper-initial-p special-words)
  • Method TRANSLATE-CAMELCASE-NAME ((name string) &key upper-initial-p special-words)
  • Method TRANSLATE-CAMELCASE-NAME ((name string) &key upper-initial-p special-words)
  • Generic-Function TRANSLATE-NAME-FROM-FOREIGN (foreign-name package &optional varp)
  • Method TRANSLATE-NAME-FROM-FOREIGN (foreign-name package &optional varp)
  • Method TRANSLATE-NAME-FROM-FOREIGN (foreign-name package &optional varp)
  • Method TRANSLATE-NAME-FROM-FOREIGN (foreign-name package &optional varp)
  • Generic-Function TRANSLATE-NAME-TO-FOREIGN (lisp-name package &optional varp)
  • Method TRANSLATE-NAME-TO-FOREIGN (lisp-name package &optional varp)
  • Method TRANSLATE-NAME-TO-FOREIGN (lisp-name package &optional varp)
  • Method TRANSLATE-NAME-TO-FOREIGN (lisp-name package &optional varp)
  • Macro DEFCFUN (name-and-options return-type &body args)
    Defines a Lisp function that calls a foreign function.
  • Macro DEFCALLBACK (name-and-options return-type args &body body)
  • Function GET-CALLBACK (symbol)
  • Macro CALLBACK (name)
  • Function GET-VAR-POINTER (symbol)
    Return a pointer to the foreign global variable relative to SYMBOL.
  • Function FOREIGN-SYMBOL-POINTER (name &key (library :default))
  • Macro DEFCVAR (name-and-options type &optional documentation)
    Define a foreign global variable.

Also exports

  • CFFI-SYS:POINTER-ADDRESS
  • CFFI-SYS:FOREIGN-FREE
  • CFFI-SYS:INC-POINTER
  • CFFI-SYS:MAKE-SHAREABLE-BYTE-VECTOR
  • CFFI-SYS:NULL-POINTER
  • CFFI-SYS:POINTERP
  • CFFI-SYS:FOREIGN-POINTER
  • CFFI-SYS:WITH-POINTER-TO-VECTOR-DATA
  • CFFI-SYS:WITH-FOREIGN-POINTER
  • CFFI-SYS:NULL-POINTER-P
  • CFFI-SYS:MAKE-POINTER
  • CFFI-SYS:POINTER-EQ

CFFI-FEATURES

  • Function CFFI-FEATURE-P (feature-expression)
    Matches a FEATURE-EXPRESSION against those symbols in *FEATURES* that belong to the CFFI-FEATURES package.

cffi-grovel

The CFFI Groveller

No packages.

cffi-libffi

No packages.

cffi-tests

No packages.

cffi-toolchain

The CFFI toolchain

No packages.

cffi-uffi-compat

UFFI Compatibility Layer for CFFI

CFFI-UFFI-COMPAT

  • Macro DEF-TYPE (name type)
    Define a Common Lisp type NAME for UFFI type TYPE.
  • Macro DEF-FOREIGN-TYPE (name type)
    Define a new foreign type.
  • Macro DEF-CONSTANT (name value &key export)
    Define a constant and conditionally export it.
  • Macro NULL-CHAR-P (val)
    Return true if character is null.
  • Macro DEF-ENUM (enum-name args &key (separator-string "#"))
    Creates a constants for a C type enum list, symbols are created in the created in the current package. The symbol is the concatenation of the enum-name name, separator-string, and field-name
  • Macro DEF-STRUCT (name &body fields)
    Define a C structure.
  • Macro GET-SLOT-VALUE (obj type field)
    Access a slot value from a structure.
  • Macro GET-SLOT-POINTER (obj type field)
    Access a pointer slot value from a structure.
  • Macro DEF-ARRAY-POINTER (name type)
    Define a foreign array type.
  • Macro DEREF-ARRAY (array type position)
    Dereference an array.
  • Macro DEF-UNION (name &body fields)
    Define a foreign union type.
  • Macro ALLOCATE-FOREIGN-OBJECT (type &optional (size 1))
    Allocate one or more instance of a foreign type.
  • Macro FREE-FOREIGN-OBJECT (ptr)
    Free a foreign object allocated by ALLOCATE-FOREIGN-OBJECT.
  • Macro WITH-FOREIGN-OBJECT ((var type) &body body)
    Wrap the allocation of a foreign object around BODY.
  • Macro WITH-FOREIGN-OBJECTS (bindings &rest body)
  • Macro SIZE-OF-FOREIGN-TYPE (type)
    Return the size in bytes of a foreign type.
  • Macro POINTER-ADDRESS (ptr)
    Return the address of a pointer.
  • Macro DEREF-POINTER (ptr type)
    Dereference a pointer.
  • Macro ENSURE-CHAR-CHARACTER (obj &environment env)
    Convert OBJ to a character if it is an integer.
  • Macro ENSURE-CHAR-INTEGER (obj &environment env)
    Convert OBJ to an integer if it is a character.
  • Macro ENSURE-CHAR-STORABLE (obj)
    Ensure OBJ is storable as a character.
  • Macro MAKE-NULL-POINTER (type)
    Create a NULL pointer.
  • Macro MAKE-POINTER (address type)
    Create a pointer to ADDRESS.
  • Macro NULL-POINTER-P (ptr)
    Return true if PTR is a null pointer.
  • Variable +NULL-CSTRING-POINTER+
    (cffi-sys:null-pointer)
    A constant NULL string pointer.
  • Macro CHAR-ARRAY-TO-POINTER (obj)
  • Macro WITH-CAST-POINTER ((var ptr type) &body body)
    Cast a pointer, does nothing in CFFI.
  • Macro DEF-FOREIGN-VAR (name type module)
    Define a symbol macro to access a foreign variable.
  • Macro DEF-POINTER-VAR (name value &optional doc)
  • Macro CONVERT-FROM-CSTRING (s)
    Convert a cstring to a Lisp string.
  • Macro CONVERT-TO-CSTRING (obj)
    Convert a Lisp string to a cstring.
  • Macro FREE-CSTRING (ptr)
    Free a cstring.
  • Macro WITH-CSTRING ((foreign-string lisp-string) &body body)
    Binds a newly creating string.
  • Macro WITH-CSTRINGS (bindings &rest body)
  • Macro DEF-FUNCTION (name args &key module (returning :void))
    Define a foreign function.
  • Function DEFAULT-FOREIGN-LIBRARY-TYPE
    Returns string naming default library type for platform
  • Function FOREIGN-LIBRARY-TYPES
    Returns list of string naming possible library types for platform, sorted by preference
  • Function FIND-FOREIGN-LIBRARY (names directories &key types drive-letters)
    Looks for a foreign library. directories can be a single string or a list of strings of candidate directories. Use default library type if type is not specified.
  • Function LOAD-FOREIGN-LIBRARY (filename &key module supporting-libraries force-load)
  • Function GETENV (var)
    Return the value of the environment variable.
  • Function RUN-SHELL-COMMAND (control-string &rest args)
    Interpolate ARGS into CONTROL-STRING as if by FORMAT, and synchronously execute the result using a Bourne-compatible shell, with output to *trace-output*. Returns the shell's exit code.
  • Macro CONVERT-FROM-FOREIGN-STRING (obj &key length (locale :default) (encoding 'cffi:*default-foreign-encoding*) (null-terminated-p t))
  • Macro CONVERT-TO-FOREIGN-STRING (obj &optional (encoding 'cffi:*default-foreign-encoding*))
  • Macro ALLOCATE-FOREIGN-STRING (size &key unsigned)
  • Macro WITH-FOREIGN-STRING ((foreign-string lisp-string) &body body)
  • Macro WITH-FOREIGN-STRINGS (bindings &body body)
  • Function FOREIGN-STRING-LENGTH (foreign-string)
  • Function CONVERT-FROM-FOREIGN-USB8 (s len)
  • Macro STRING-TO-OCTETS (str &key encoding null-terminate)
  • Macro OCTETS-TO-STRING (octets &key encoding)
  • Function FOREIGN-ENCODED-OCTET-COUNT (str &key encoding)