Previous: , Up: iklib programs   [Index]


6.2.3 Loading host’s foreign libraries

Vicare extends the format of top–level programs by allowing an optional foreign-library clause:

(program ?program-name
  (foreign-library ?shared-object-id)
  (import  ?import-spec ...)
  . ?program-body)

where each ?shared-object-id is a Scheme string object. There can be any number of foreign-library clauses, before the import one.

The clause foreign-library allows us to associate a host’s shared object to the Scheme program, so that, whenever the program is expanded from source code or loaded from a FASL file: the shared object is dynamically loaded with a call to the operating system’s function dlopen(). foreign for details.