Next: , Previous: The define-alien-routine Macro, Up: Foreign Function Calls


7.7.3 define-alien-routine Example

Consider 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).