chickadee » chicken » base » require-library

(require-library ID ...)syntax

This form does all the necessary steps to make the libraries or extensions given in ID ... available. It loads syntactic extensions, if needed and generates code for loading/linking with core library modules or separately installed extensions.

During interpretation/evaluation require-library performs one of the following:

  • If ID names a built-in feature chicken srfi-0 srfi-2 srfi-6 srfi-8 srfi-9 srfi-10 srfi-17 srfi-23 srfi-30 srfi-39 srfi-55, then nothing is done.
  • If ID names one of the syntactic extensions chicken-syntax chicken-ffi-syntax, then this extension will be loaded.
  • If ID names one of the core library units shipped with CHICKEN, then a (load-library 'ID) will be performed.
  • If ID names an installed extension with the syntax or require-at-runtime attribute, then the extensions is loaded at compile-time, probably doing a run-time (require ...) for any run-time requirements.
  • Otherwise, (require-library ID) is equivalent to (require 'ID).

During compilation, one of the following happens instead:

  • If ID names a built-in feature chicken srfi-0 srfi-2 srfi-6 srfi-8 srfi-9 srfi-10 srfi-17 srfi-23 srfi-30 srfi-39 srfi-55, then nothing is done.
  • If ID names one of the syntactic extensions chicken-syntax chicken-ffi-syntax, then this extension will be loaded at compile-time, making the syntactic extensions available in compiled code.
  • If ID names one of the core library units shipped with CHICKEN, or if the option -uses ID has been passed to the compiler, then a (declare (uses ID)) is generated.
  • If ID names an installed extension with the syntax or require-at-runtime attribute, then the extension is loaded at compile-time, and code is emitted to (require ...) any needed run-time requirements.
  • Otherwise (require-library ID) is equivalent to (require 'ID).

ID should be a pure extension name and should not contain any path prefixes (for example dir/lib... is illegal).

ID may also be a list that designates an extension-specifier. Currently the following extension specifiers are defined:

  • (srfi NUMBER ...) is required for SRFI-55 compatibility and is fully implemented
  • (version ID NUMBER) is equivalent to ID, but checks at compile-time whether the extension named ID is installed and whether its version is equal or higher than NUMBER. NUMBER may be a string or a number, the comparison is done lexicographically (using string>=?).