Next: , Previous: , Up: Top   [Index]


11 Foreign functions interface

The library (vicare ffi) interfaces with the host operating system and other external libraries exposing a C language interface; it is suggested to import the FFI library with the prefix ffi::, as in the following prelude:

#!r6rs
(import (rnrs)
  (prefix (vicare ffi) ffi::))

The facilities of the (vicare ffi) give the Scheme program unrestricted access to the computer memory, allowing one to allocate, access, modify, and free memory as needed. The facilities also allow the Scheme program to call out to system procedures as well as allow the native procedures to call back into Scheme.

Additionally, (vicare ffi) reexports all the bindings from the library (vicare system $foreign).

The availability of the Libffi API can be tested at run–time with the function vicare-built-with-ffi-enabled from (vicare) (see vicare-built-with-ffi-enabled), and at expand–time with the clause ffi-enabled of cond-expand from SRFI-0 ((vicare-libs)ffi-enabled).

Vicare defines an API to handle pointer objects, iklib pointers for details.