next up previous contents index
Next: Accessing Lisp Arrays Up: Alien Function Calls Previous: def-alien-routine Example   Contents   Index

Calling Lisp from C

Calling Lisp functions from C is sometimes possible, but is rather hackish. See funcall0 ... funcall3 in the `'lisp/arch.h. The arguments must be valid CMU CL object descriptors (e.g. fixnums must be left-shifted by 2.) See `'compiler/generic/objdef.lisp or the derived file `'lisp/internals.h for details of the object representation. `'lisp/internals.h is mechanically generated, and is not part of the source distribution. It is distributed in the `'docs/ directory of the binary distribution.

Note that the garbage collector moves objects, and won't be able to fix up any references in C variables, so either turn GC off or don't keep Lisp pointers in C data unless they are to statically allocated objects. You can use (page [*])purify to place live data structures in static space so that they won't move during GC.


change_begin

change_end


Peter Van Eynde 2000-02-08