27.  Loading  

(load file)
(load file environment)

Loads a source file or one or more object files. If the file contains source code, the expressions in the file are read and evaluated. If a file contains object code, the contents of the file is linked together with the running interpreter and with additional libraries that are specified by the variable load-libraries (see below). Names of object files must have the suffix ``.o''. load returns void.

file must be either a string or a symbol or a list of strings or symbols. If it is a list, all elements of the list must be the names of object files. In this case, all object files are linked by a single run of the linker.
If an optional environment is specified, the contents of the file is evaluated in this environment instead of the current environment.

Loading of object files is not supported on some platforms. On the platforms where it is supported, the feature elk:load-object is provided by the interpreter on startup (see ``Features'' below).
Example:

(fluid-let ((load-noisily? #t))
  (load 'test.scm))

load-path

This variable is defined in the global environment. It is bound to a list of directories in which files to be loaded are searched for. Each element of the list (a string or a symbol) is used in turn as a prefix for the file name passed to load until opening succeeds. Elements of load-path that are not of type string or symbol are ignored.

If the value of load-path is not a list of at least one valid component, or if the name of the file to be loaded starts with ``/'' or with ``~'', it is opened directly.

The initial value of load-path is a list of the three elements ``.'' (i.e. the current directory), ``$scheme_dir'', and ``$lib_dir''; $scheme_dir and $lib_dir are the directories into which the runtime Scheme files and object files are installed (typically ``/usr/elk/runtime/scm'' and ``/usr/elk/runtime/obj''; defined in the installation's site file).

load-noisily?

This variable is defined in the global environment. When a file is loaded and the value of load-noisily? is true, the result of the evaluation of each expression is printed. The initial value of load-noisily? is #f.

load-libraries

This variable is defined in the global environment. If load-libraries is bound to a string, its value specifies additional load libraries to be linked together with an object file that is loaded into the interpreter (see load above). Its initial value is ``-lc''.

(autoload symbol file)

Binds symbol in the current environment (as with define). When symbol is evaluated the first time, file is loaded. The definitions loaded from the file must provide a definition for symbol different from autoload, otherwise an error is signaled.

file must be either a string or a symbol or a list of strings or symbols, in which case all elements of the list must be the names of object files (see load above).

autoload-notify?

This variable is defined in the global environment. If the value of autoload-notify? is true, a message is printed whenever evaluation of a symbol triggers autoloading of a file. autoload-notify? is bound to #t initially.


Markup created by unroff 1.0,    September 24, 1996,    net@informatik.uni-bremen.de