I am figurirng out my way through cffi, and I cannot figure out the following (this is in clisp):
Suppose I have a C functions that returns a result via a pointer. Its definition is:
foo a, b, &c
and then I want to do 3 * c.
What do I have to give for c? I do have its address. Should I use mem-ref, or convert-from-foreign, or something else?
Here is a scetch (where I already did defcfun ("foo" foo) ...)): (let ((*c (foreign-alloc :float)) (foo a b *c) (* 3 (??? *c))
Thank you,
Mirko
On Thu, Jun 27, 2013 at 12:10 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
What do I have to give for c? I do have its address. Should I use mem-ref, or convert-from-foreign, or something else?
You want mem-ref.
HTH,
-- Luís Oliveira http://kerno.org/~luis/