Chapter 1. System building

1.1. Introduction
1.2. System definition files
1.3. Practical examples
1.4. ASDF Reference
asdf:make-build — Block-build an ASDF system definition
asdf:load-fasl-op — Compile and load one ore more libraries using unified FASL

1.1. Introduction

A typical application will consist of multiple lisp files that have to be compiled and which will probably be linked to additional, third party libraries, either written themselves in Common Lisp or shipped as foreign C or C++ dynamically or statically linked lirbaries. Not only loading these files into a running ECL can be a slow process in some platforms, but shipping code in the form of multiple binaries and a script to load them is far from optimal.

Traditionally, Common Lisp implemenations have provided a function to save the dump all data from a running Lisp process into a file. The result was called the Lisp image and could be shipped to other version compatible implementations.Nowadays, having less control of the systems it runs in, a Lisp implementation must work very hard to dump memory images and be able to load and execute them afterwards.

ECL has chosen to avoid this process entirely. Instead, we conceive five different portable models for building and shippin your programs. The models, described in Table 1.1, enumerate the different kinds of files that ECL can portably produce. To get one or more of the products mentioned in the table, you may resort to a low level API described in Part III. However, we recommend a simpler way based on using System Definition Files to describe the structure of your project and let ECL build the desired target for you. This approach is described in the following sections.

Table 1.1. Code distribution models

ModelDescription:TYPE:MONOLITHIC
Source code

You distribute your programs in source code form. This is the easiest and most portable way, but not the fastest one.

NANA
FASL or loadable file

Best suited for development. You translate all lisp code to C and link it against possibly other C/C++ libraries to obtain a single binary file with extension .fas, like the compiled files you obtain from using compile-file. This "unified" FASL can be loaded a startup time to add new functionality to the ECL environment.

:FASLT/NIL
Standalone program

Product shipping for final user. You translate all your lisp code to C using the ECL compiler. The final object files can be linked against other C/C++ libraries to obtain a standalone executable.

:PROGRAMT
Statically linked library

For embedding purposes. You translate all your lisp code to C and combine the resulting object files into a single library with .a or .lib extension. You can distribute this library to other people and the final users can utilize these libraries to build standalone programs.

:LIBT/NIL
Dynamically linked library

For embedding purposes. Similar to a statically linked library, but it is loaded at run time by the operating system and can be shared by more than one instance of a program.

:LIBT/NIL