Next: foreign-funcall-pointer-varargs, Previous: foreign-funcall-pointer, Up: Functions [Contents][Index]
fixed-arguments ::= { arg-type arg }* [return-type]
arguments ::= { arg-type arg }* [return-type]
name-and-options ::= name | (name &key library convention)
A Lisp string.
A foreign type.
An argument of type arg-type.
A foreign type, :void
by default.
A lisp object.
A lisp symbol; not evaluated.
One of :cdecl
(default) or :stdcall
.
The foreign-funcall-varargs
macro is the main primitive for
calling foreign variadic functions. It behaves similarily to
foreign-funcall
except fixed-arguments
are distinguished
from the remaining arguments.
CFFI> (with-foreign-pointer-as-string (s 100)
(setf (mem-ref s :char) 0)
(foreign-funcall-varargs
"sprintf" (:pointer s :string) "%.2f")
:double (coerce pi 'double-float) :int))
⇒ 3.14