[comp.lang.lisp] Interfacing Lucid and C

phs@lifia.imag.fr (Philippe Schnoebelen) (02/07/89)

I'm having problems interfacing Lucid and C when it comes to complicated
data structures, and I would like to know if anybody has experience of
these problems.

Specifically, I'm trying to pass a Lisp stream to a C function, (or more
precisely the C 'FILE' presumably built into the Lisp stream) so that I can
consume it by getchar (say). Anybody knows how to do that ? (If that helps,
I'm using Lucid 2.1.1 on Suns).


Much thanks in advance,
--
Philippe SCHNOEBELEN,				Best:        phs@lifia.imag.fr
LIFIA - INPG,
46, Avenue Felix VIALLET			2nd:		phs@lifia.UUCP
38000 Grenoble, FRANCE				last: ..!mcvax!inria!lifia!phs

"Algebraic symbols are used when you do not know what you are talking about."

sokolov@mit-amt (Michael Sokolov) (02/10/89)

Re: FILE / stream connection.

Try using the lisp function "extract-stream-handles." I believe 
that this returns the file descriptor (not FILE pointer). Then you could 
use UNIX "read" command instead of getchar. I don't think Lucid makes 
a FILE pointer. 

As far as passing general structures back and forth, there is a not-very-
pretty way to do it, which is to call the structure an array of type 
'(unsigned-byte 32) in lisp, and a structure in C. Then you can access
the elements of a C structure from Lisp if you know the correct
offsets into the structure...

-MS