See the LispWorks Foreign Language Interface User Guide and Reference Manual for details of these changes.
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.
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.
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.
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.
You can now pass and receive strings in FLI calls using the :koi8-r
external format.
The new :embedded-module
member option for lw:defsystem
creates an FLI embedded module of the given name, instead of loading the object file.
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