All Manuals > LispWorks Release Notes and Installation Guide > 15 Release Notes


15.12 Foreign Language interface changes

See the LispWorks Foreign Language Interface User Guide and Reference Manual for details of these changes.

15.12.1 64-bit integer FLI types fully supported in 32-bit LispWorks

64-bit integer types such as (:long :long), :int64 and :uint64 are now supported on 32-bit LispWorks for fli:define-foreign-callable and also for struct, union and pointer access with functions such as fli:foreign-slot-value and fli:dereference. In LispWorks 6.1 and earlier versions, they could only be used by fli:define-foreign-function.

64-bit LispWorks has always supported 64-bit integer FLI types.

15.12.2 Structure pointer allowed when passing structures by value

In LispWorks 6.1 and earlier versions, a foreign function argument whose type is a struct (that is, passing the structure by value) required a foreign struct object to be used. The LispWorks FLI now also allows a pointer to a foreign struct to be used.

15.12.3 Creating a pointer to a defined foreign symbol

The new function fli:foreign-function-pointer returns a FLI pointer with its address set to the address of a foreign symbol, which can be either a symbol defined in a foreign library or a foreign callable.

fli:foreign-function-pointer has several advantages over fli:make-pointer, when making a pointer to a defined foreign symbol. The pointer is automatically updated on image restart, for a given symbol the same pointer is returned in each call so repeated allocation is avoided. fli:foreign-function-pointer is especially useful for creating pointers for passing the address of foreign callables to foreign code in situations where the same address is used repeatedly.

On the other hand fli:foreign-function-pointer keeps a Lisp pointer to its result. Therefore if you use the FLI pointer only once you should create it with fli:make-pointer, to allow the Garbage Collector to discard it.

15.12.4 make-pointer requires address or symbol-name

The function fli:make-pointer now checks that either the symbol-name or address keyword argument is supplied, and signals an error otherwise. In LispWorks 6.1 and earlier versions it does not check, which can lead to incorrect behavior on some operating systems.

15.12.5 KOI8-R encoding supported

You can now pass and receive strings in FLI calls using the :koi8-r external format.

15.12.6 Incorporating a foreign module into the image with defsystem

The new :embedded-module member option for lw:defsystem creates an FLI embedded module of the given name, instead of loading the object file.

15.12.7 New type descriptor fli:released-foreign-block-pointer

The system marks foreign blocks that have been released (by fli:foreign-block-release) as being of this foreign type.

LispWorks Release Notes and Installation Guide - 2 Mar 2015