Compiles and loads C code, or allows it to be included in a Lisp fasl file, in 32-bit LispWorks on Solaris and HP-UX.
c-string is a string containing C source code.
If
control
is
:fasl
, the C code is compiled at Lisp
compile-file
time into a temporary
.o
file. The resulting object module is stored in the fasl file. If the value is
:object
, the C code is compiled at
compile-file
time into a
.o
file with the same name as the Lisp source file, and loaded when the fasl file is loaded. If the value is
:source
, compilation and loading of the C code is done when the macro function is evaluated. The default value of
control
is
:fasl
.
Note:
process-foreign-code
is implemented only in 32-bit LispWorks on Solaris and HP-UX.
Note: The Foreign Parser is loaded by:
(require "foreign-parser")
When this statement is evaluated the C code is compiled and also loaded into the image:
(foreign-parser:process-foreign-code
"int sum (int a, int b)
{ return a+b; } "
:control :source)
The C function can be called from Lisp in the usual way:
(fli:define-foreign-function sum
((a :int)
(b :int))
:result-type :int)
(sum 2 3) => 5
define-foreign-function
link-load:read-foreign-modules
in the
LispWorks Reference Manual
.