Next: Calling Lisp From C, Previous: The define-alien-routine Macro, Up: Foreign Function Calls
define-alien-routine
ExampleConsider the C function cfoo
with the following calling
convention:
void cfoo (str, a, i) char *str; char *a; /* update */ int *i; /* out */ { /* body of cfoo(...) */ }
This can be described by the following call to
define-alien-routine
:
(define-alien-routine "cfoo" void (str c-string) (a char :in-out) (i int :out))
The Lisp function cfoo
will have two arguments (str and
a) and two return values (a and i).