Scieneer Common Lisp 1.3.9 online documentation

alien:def-alien-routine name result-type &rest args[Macro]

def-alien-routine name result-type {(arg-name arg-type [style])}*

Define a foreign interface function for the routine with the specified name, which may be either a string, symbol or list of the form (string symbol). The result-type is the alien type for the function return value - void may be used to specify a function with no result.

The remaining forms specifiy individual arguments that are passed to the routine. The arg-name is a symbol that names the argument, primarily for documentation. The arg-type is the C-Type of the argument. Style specifies the say that the argument is passed.

:in
An :in argument is simply passed by value. The value to be passed is obtained from argument(s) to the interface function. No values are returned for :in arguments. This is the default mode.
:out
The specified argument type must be a pointer to a fixed sized object. A pointer to a preallocated object is passed to the routine, and the the object is accessed on return, with the value being returned from the interface function. :out and :in-out cannot be used with pointers to arrays, records or functions.
:copy
Similar to :in, except that the argument values are stored in on the stack, and a pointer to the object is passed instead of the values themselves.
:in-out
A combination of :out and :copy. A pointer to the argument is passed, with the object being initialized from the supplied argument and the return value being determined by accessing the object on return.