ACL 4.3 FFI compatibility issues

$Revision: 1.1 $

This document was provided to users of Allegro CL release 5.0/5.0.1 to assist in porting Allegro CL 4.3 applications to the new release. We provide it, essentially unedited, for any users of release 6.0 who might need it.

Table of Contents


Introduction

To use the compatibility mode, (require :ffcompat) and use the old (Allegro CL 4.3) functionality.  Most of the Allegro CL 4.3 interface is identical, including all of the deprecations between Allegro CL 4.2 and 4.3.

The following exceptions apply:

Notes:

The use of :fixnum or :integer to accept a short return value is not supported by defforeign. Therefore, use of this model to return shorts, without subsequent post-processing, is in fact a bug in user code. However, it usually did seem to work on Unix systems in 4.3. But again, it does not work in Windows and may not work in subsequent Unix versions.

To fix unsigned short returns, continue to accept the value with the :return-type of :fixnum or :integer, but wrap each call in a

(logand res #xffff) 

to get the correct bits.

To fix signed short values, you can specify :signed-short as the :return-type in the defforeign definition, even though it is not documented as part of the 4.3 defforeign interface.


UNIX Symbols (exported from FF)

char*-to-string char*-to-string (same)
char*-string-length ff:foreign-strlen
convert-to-lang function convert-foreign-name
def-c-type macro def-foreign-type
def-c-typedef macro def-foreign-type
defcstruct macro def-foreign-type
defforeign function def-foreign-call
defforeign-list function obsolete
defun-c-callable macro defun-foreign-callable
foreign-address obsolete
foreign-argument (symbol no longer exported) obsolete
free-cstruct free-fobject
get-entry-point function get-entry-point (same)
get-entry-points function obsolete (calls get-entry-point repeatedly)
get-extern-code-address function obsolete, calls get-entry-point
get-extern-data-address function obsolete, calls get-entry-point
lisp-call function (no longer defined) See Calling foreign callables from Lisp in foreign-functions.htm
lisp-value lisp-value (same)
load extension load extension
make-cstruct allocate-fobject
malloc-cstruct allocate-fobject
register-function register-foreign-callable
register-value register-lisp-value
remove-entry-point function obsolete
remove-extern-code-address function obsolete
remove-extern-data-address function obsolete
reset-entry-point-table function (no longer defined) obsolete
string-to-char* function string-to-char* (same)
unload-file function (no longer defined) unload-foreign-library
unregister-function unregister-foreign-callable
unregister-value unregister-lisp-value

UNIX Types

  :char   :byte    :unsigned-char   :unsigned-byte
  :int    :long    :unsigned-int    :unsigned-long
  :short  :unsigned-short
  :float  :double
  :bit ***
  :union  :struct  :array
  :lisp

Copyright (C) 1998-1999, Franz Inc., Berkeley, CA. All Rights Reserved.