This section describes particular issues relevant to a delivered image containing Foreign Language Interface (FLI) code.
The Foreign Language Interface requires compiled code (known as FLI templates) to convert between foreign objects and Lisp objects. Most of these FLI templates are already available in the image, and most applications do not need extra templates.
However it is difficult to know in advance exactly which FLI templates will be needed. When a new template is actually required, it is compiled. In a delivered image where the compiler has been removed, this causes an error like this:
This prints all the templates that were generated while exercising your application. These FLI template forms should be put in a file which is compiled and loaded as part of your application.
FLI:PRINT-COLLECTED-TEMPLATE-INFO takes a keyword
:OUTPUT-STREAM to make this easier, for example:
In most cases foreign callable names are passed to
deliver in the value of the
:dll-exports keyword argument, and each of these foreign callables will be retained automatically in the delivered image.
However other foreign callables defined with a string foreign-name are liable to be shaken from the delivered image. The best approach is to use a symbol to name such foreign callables, as described under
fli:define-foreign-callable in the
LispWorks Foreign Language Interface User Guide and Reference Manual
LispWorks Delivery User Guide - 10 Aug 2017