Next: , Previous: , Up: Functions   [Contents][Index]


foreign-funcall-pointer-varargs

foreign-funcall-pointer-varargs

Syntax

Macro: foreign-funcall-pointer-varargs pointer options (fixed-arguments) &rest arguments ⇒ return-value

fixed-arguments ::= { arg-type arg }* [return-type]
arguments ::= { arg-type arg }* [return-type]
options ::= (&key convention)

Arguments and Values

pointer

A foreign pointer.

arg-type

A foreign type.

arg

An argument of type arg-type.

return-type

A foreign type, :void by default.

return-value

A lisp object.

convention

One of :cdecl (default) or :stdcall.

Description

The foreign-funcall-pointer-varargs macro is the main primitive for calling foreign variadic functions. It behaves similarily to foreign-funcall-pointer except fixed-arguments are distinguished from the remaining arguments.

Examples

  CFFI> (with-foreign-pointer-as-string (s 100)
          (setf (mem-ref s :char) 0)
          (foreign-funcall-pointer-varargs
           (foreign-symbol-pointer "sprintf") () (:pointer s :string "%.2f")
           :double (coerce pi 'double-float) :int))
  ⇒ 3.14