Package: cffi

Macro defctype

Lambda List

defctype (name base-type &optional documentation)


name -- The name of the new foreign type.
base-type -- A symbol or a list defining the new type.
documentation -- A documentation string, currently ignored.


The defctype macro provides a mechanism similar to C's typedef to define new types. The new type inherits base-type's translators, if any. There is no way to define translations for types defined with defctype. For that, you should use define-foreign-type.


  (defctype my-string :string
    "My own string type.")

(defctype long-bools (:boolean :long) "Booleans that map to C longs.")