6 Application Deployment

6.1 Linking Functors

Application development can be considerably eased by splitting the application in a large number of orthogonal and reusable functors. However, deployment of an application gets harder in the presence of a large number of functors:

  1. Installing the application requires correct installation of a large number of functors.

  2. Execution might be slow due to frequent file- or even network accesses.

The commandline tool ozl eases deployment by creating a new functor that includes imported functors in a prelinked fashion: it is possible to collapse a collection of functors into a single equivalent one. The model that should be kept in mind, is that the newly created functor employs an internal, private module manager that executes the toplevel application functor together with all included functors.

The linker can be invoked on the input functor In in order to create an output functor Out as follows:

ozl In -o Out

For example, from the pickled toplevel functor LMF.ozf a new functor can be created as follows:

ozl LMF.ozf -o LMF.oza

where the pickled functor LMF.ozf is created by compilation as follows:

ozc -c LMF.oz -o LMF.ozf

Now the newly created pickled functor LMF.oza can be installed everywhere, the functors stored in DB.ozf and Form.ozf are included in LMF.oza.

The linker can be used in verbose mode with the option --verbose (or -v as abbreviation). In verbose mode the linker prints information on which functors are included and which functors are imported by the newly created functor. For example,

ozl -v LMF.ozf -o LMF.oza

prints something like

Include:
   /home/schulte/DB.ozf, /home/schulte/Form.ozf,
   /home/schulte/LMF.ozf.
Import:
   x-oz://system/Application.ozf, x-oz://system/System.ozf,  
   x-oz://system/Tk.ozf.

The linker also supports options that control which functors are included, for more information see Chapter 3 of ``Oz Shell Utilities''.

6.2 Compressed Pickled Functors

Pickles created by the compiler and linker can also take advantage of compression. For that matter, both tools support the --compress (or -z as shortcut) option that must be followed by a single digit that defines the compression level to be used.

For example, the pickled functor LMF.oza can be created compressed by

ozl --compress 9 LMF.ozf -o LMF.oza

This reduces the used disk space by 50%.

6.3 Executing Functors

This section shows a convenient form to execute functors.

The option --exec (or -x as shortcut) can be supplied to both compiler and linker. Functors that are created with that option can be directly executed. For example, the file lmf.exe created with

ozl -x LMF.ozf -o lmf.exe

can be directly executed:

lmf.exe

The pickled functor lmf.exe just features a particular header that allows direct execution. It can still be used together with the ozengine program:

ozengine lmf.exe

Naturally, the extension .exe can be omitted under Unix.


Denys Duchier, Leif Kornstaedt and Christian Schulte
Version 1.4.0 (20080702)