From ... From: Erik Naggum Subject: Re: Interfacing to C code Date: 2000/05/05 Message-ID: <3166512264635721@naggum.no>#1/1 X-Deja-AN: 619529103 References: mail-copies-to: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsmaster@eunet.no X-Trace: oslo-nntp.eunet.no 957523866 633 195.0.192.66 (5 May 2000 10:51:06 GMT) Organization: Naggum Software; vox: +47 8800 8879; fax: +47 8800 8601; http://www.naggum.no User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.6 Mime-Version: 1.0 NNTP-Posting-Date: 5 May 2000 10:51:06 GMT Newsgroups: comp.lang.lisp * 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. #:Erik