Subject: Re: Interfacing to C code
From: Erik Naggum <>
Date: 2000/05/05
Newsgroups: comp.lang.lisp
Message-ID: <>

* Jonathan <>
| Shouldn't it know from the definition that the C func wants the
| address and not the value?

  No.  Lisp function calls evaluate all arguments in order, then call
  the function with the values so evaluated.  However, most values are
  actually pointers to boxes -- integers are sort of a special case.
  Try passing a cons cell.  If you pre-allocate a structure to fill in
  with values, you don't need to affect the Lisp binding, but you need
  to know how Lisp stores its values.  This can be complicated.  If
  the values in that structure are only going to be used in the C
  world, you can allocate it there and return a magic value that the C
  world knows what means.  Should you need to access the values from
  the Lisp world, the FFI should be able to handle individual values
  automatically, while aggregates may need some extra work.