Next: , Previous: free-translated-object, Up: Foreign Types


translate-from-foreign

Syntax

— Generic Function: translate-from-foreign foreign-value type-name ⇒ lisp-value

Arguments and Values

foreign-value
The foreign value to convert to a Lisp object.
type-name
A symbol naming a foreign type defined by defctype.
lisp-value
The lisp value to pass in place of foreign-value to Lisp code.

Description

This generic function is invoked by CFFI to convert a foreign value to a Lisp value, such as when returning from a foreign function, passing arguments to a callback function, or accessing a foreign variable.

To extend the CFFI type system by performing custom translations, this method may be specialized by eql-specializing type-name on a symbol naming a foreign type defined with defctype. This method should return the appropriate Lisp value to use in place of the foreign value.

The results are undefined if the type-name parameter is specialized in any way except an eql specializer on a foreign type defined with defctype. Specifically, translations may not be defined for built-in types.

See Also

Foreign Type Translators
translate-to-foreign
free-translated-object