All Manuals > Delivery User Guide > 3 Writing Code Suitable for Delivery

3.1 Separate run time initializations from the build phase

To deliver a runtime application correctly, you need two distinct phases: the build phase, and the run time phase.

In the build phase the delivery script loads the application code including the definition of its start-up function, but should not actually do any run time initialization. It then saves the executable or dynamic library to disk. An executable is primed with the start-up function as its entry point.

In the run time phase the end-user runs the executable which calls its start-up function. This function must perform any required run time initializations, and not attempt to load any more application code.

You may have developed or inherited a program with a control file which loads your application, initializes and starts it successfully in the LispWorks IDE, but which fails when used as a delivery script. For example it might run code which relies on multiprocessing.

To correctly deliver this program as a LispWorks runtime application you will need to remove those forms from the control file which do run time initialization, and cause them to occur at run time by adding them to the start-up function. Take care to preserve the order of initializations when you do this.


Delivery User Guide - 01 Dec 2021 19:35:03