LispWorks Delivery User Guide > 9 Delivery and Internal Systems > 9.5 Delivery and the FLI

NextPrevUpTopContentsIndex

9.5.1 Foreign Language Interface templates

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:

FLI template needs to be compiled
(see 'Foreign Language Interface templates' in the LispWorks Delivery User Guide):
  (FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-SETTER-FUNCTIONS ((:FLOAT :SIZE 4)))

To solve this you need to find which templates your application uses that are not already available, compile them, and load them before delivering.

To find which templates your application needs, do the following:

  1. Start the undelivered application image (that is, LispWorks with your application code loaded).
  2. Call
  3. (FLI:START-COLLECTING-TEMPLATE-INFO)
  4. Exercise the application.
  5. Call
(FLI:PRINT-COLLECTED-TEMPLATE-INFO)

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:

(with-open-file (stream "fli-templates.lisp" :direction :output)
                (FLI:PRINT-COLLECTED-TEMPLATE-INFO 
                  :OUTPUT-STREAM stream
))

Once you have compiled the file containing the templates, it should be loaded as part of your application.


LispWorks Delivery User Guide - 22 Dec 2009

NextPrevUpTopContentsIndex