#
Chapter 7
Extensions and `csi -setup`

To simplify the management of extension libraries, a simple mechanism based on shared object files and dynamic loading is used to allow the loading of extension libraries at run-time. Currently this mechanism is only available on platforms that support dynamic loading of shared object files, at the time of writing this is Linux, FreeBSD, HP/UX, Windows (Cygwin) and Solaris. The macro `chicken-setup` is used to make packaging, building and installation as simple as possible for the user.

An extension is a compressed archive containing the source-code, compilation parameters and additional information. Technically an extension is a gzipped tar-archive, containing the source file (or a directory hierarchy with source files, in the case extensions containing multiple modules) and a setup script with additional information.

The Chicken interpreter provides an option for performing basic operations on extensions. To build and install an extension, enter

    % csi -setup EXTENSION

(Note that you have to have write-access for the directory where system-wide extensions are installed. Normally this directory is `/usr/local/lib/chicken`. You can create this directory by entering `csi -setup` without additional parameters.)

The registry will be created automatically on its first use. To create the registry explicitly, enter

    csi -setup -init

This will overwrite any existing registry (after asking the user for confirmation). This may also be needed should the extension-registry be damaged.

If you want to have your extensions installed at a different location than the default, you have two choices: either set the environment-variable `CHICKEN_REGISTRY` to the name of your desired registry-directory, or create a directory named `$HOME/.chicken-registry`.

To ``wrap'' up an extension, that is, to create a packaged archive ready for distribution, enter

    % csi -setup EXTENSION -wrap

The `-setup` option loads the setup-script `EXTENSION.setup` and passes any arguments that follow the extension-name as command-line arguments.