Package: cffi
Macro foreign-funcall
Lambda Listforeign-funcall (name-and-options &rest args) Syntaxarguments ::= { arg-type arg }* [return-type] name-and-options ::= name | (name &key library convention) Argumentsname -- A Lisp string. arg-type -- A foreign type. arg -- An argument of type arg-type. return-type -- A foreign type, :void by default. library -- A lisp symbol; not evaluated. convention -- One of :cdecl (default) or :stdcall. Return ValueA lisp object. Details The foreign-funcall macro is the main primitive for calling foreign functions. Note: The return value of foreign-funcall on functions with a :void return type is still undefined. Implementation-specific Notes Corman Lisp does not support foreign-funcall. On implementations that do not support foreign-funcall the symbol cffi-sys::no-foreign-funcall will be present in *features*. Note: in these Lisps you can still use the defcfun interface. ExamplesCFFI> (foreign-funcall "strlen" :string "foo" :int) => 3Given the C code: void print_number(int n) { printf("N: %dn", n); }Or, equivalently: CFFI> (foreign-funcall "print_number" :int 123456 :void) -| N: 123456 => NIL | See also |