All Manuals > LispWorks Foreign Language Interface User Guide and Reference Manual > 5 Function and Macro Reference

NextPrevUpTopContentsIndex

define-foreign-funcallable

Macro
Summary

Defines a Lisp function which, when passed a pointer to a foreign function, calls it.

Package

fli

Signature

define-foreign-funcallable the-name args &key lambda-list documentation result-type language no-check calling-convention => the-name

args ::= ({ arg }*)

Arguments

the-name

A symbol naming the Lisp function.

The other arguments are interpreted as by define-foreign-function.

Description

This is like define-foreign-function, but creates a function with an extra argument at the start of the argument list for the address to call.

Example

Define a caller for this shape:

(fli:define-foreign-funcallable 
 call-with-string-and-int
 ((string (:reference-pass :ef-mb-string))
  (value :int)))

printf is defined here:

(fli:register-module "msvcrt")

Call printf. Note that the output goes to console output which is hidden by default:

(let ((printf-func 
       (fli:make-pointer :symbol-name "printf")))
  (call-with-string-and-int
   printf-func "printf called with %d" 1234))
See also

define-foreign-function


LispWorks Foreign Language Interface User Guide and Reference Manual - 7 Dec 2011

NextPrevUpTopContentsIndex