[Openmcl-devel] FFI question: passing aligned pointers

R. Matthew Emerson rme at clozure.com
Mon Dec 6 12:23:46 PST 2010


On Dec 3, 2010, at 5:14 AM, Artem Mironov wrote:

> I'm new to CCL and to Lisp in general. I have a question about passing
> C pointers to/from C functions using (external-call ...).
> 
> A C pointers returned by system's malloc() are aligned by at least 8 bytes.
> Such pointers can be safely passed to/from lisp as fixnums, without boxing
> into macptr.
> 
> I'm looking for something like this:
> 
> (external-call "c_function" :fixnum 0 :int 7 :fixnum)
> 
> Is there such feature or where to look to try to implement it?

Are you worried about consing a lot of macptrs?  In many cases, macptrs can be stack-allocated.

http://ccl.clozure.com/ccl-documentation.html#Referencing-and-Using-Foreign-Memory-Addresses




More information about the Openmcl-devel mailing list