From: Dave R. <da...@sy...> - 2002-10-01 13:03:07
|
> I have decided to take a different approach to implementing my TCP-based > server. Rather than use the socket server/stream classes, I am > going to try > accessing the socket calls directly. This is how CMUCL handles > the problem > and my early tests on CMUCL have been quite favorable. Which leads to my > question: > > Is it possible in the FFI to define a c-struct > (def-c-struct) then create > an instance of it in LISP, initialize it, then pass a pointer to > it via FFI? > I guess what I am asking is whether it's possible to allocate a c-place > inside the LISP heap. > My reading of the implementation notes imply that > "c-places" originate > outside the LISP heap, i.e. have static storage class. One could > infer that > C code could malloc() a region and return this, but how then do we ensure > free() is called at GC finalization? Ah! WITH-FOREIGN-OBJECT. That'll do it. |