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


3.1 Separate runtime initializations from the build phase

To deliver a runtime application correctly, you need two distinct phases: the build phase , and the runtime 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 runtime initialization. It then saves the executable to disk, with the start-up function primed as the entry point.

In the runtime phase the end-user runs the executable which calls its start-up function. This function must perform any required runtime 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 runtime initialization, and move them to the runtime by adding them to the start-up function. Take care to preserve the order of initializations when you do this.

LispWorks Delivery User Guide - 13 Dec 2011