chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Multiple return values


From: felix
Subject: Re: [Chicken-users] Multiple return values
Date: Wed, 09 Oct 2002 22:41:08 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Peter Keller wrote:
On Wed, Oct 09, 2002 at 09:39:22PM +0200, felix wrote:

`define-external' is exactly what you want.


Well, the documentation was kinda bad for this, so I don't really know
what it is for or how to use it correctly. But I haven't looked recently
at the docs, so you might have made a bunch of additions I don't know
about yet. I remember you saying you were working on the docs for the
FFI a while ago.

Ahem...Yes. I remember.



What about arrays?

;; does this make sense?
(let-location ((i integer (s32vector 1 2 3 4 5 6 7)))
        ...)


No. `i' is an integer, but you assign a vector.


Though, in C, a reference parameter in a function is the same as for a
single variable, or an array, you could utilize this. I don't see why you
couldn't do with locations what I did with the intp-* functions and make
them based on arity for if they deal with a vector in the location or
not. A location pointing to a single integer is equivalent to a location
pointing to the first element of a srfi-4 vector....

Not quite: the location represents a piece of storage that contains
the a data object of the given type. So the actual *size* is crucial.
The situation is different for pointers, of course.
But since vectors can be passed directly to foreign code, plus
locatives, I'm not sure what you want to achieve with your example

(but I'm not too receptive today, vacation is over, 8 hours of C++
coding take their toll...)


There are plenty of other lib FFIs that are in my queue(zlib, opcodes,
opengl/glut, sdl, png, jpeg), but I want to get the knowledge down of
chicken's FFI so I can produce intelligent scheme interfaces to them.
Currently, zlib is sorta waiting on this discussion.


Cool. Hm. This calls for a decent C-headerfile parser, actually...


cheers,
felix





reply via email to

[Prev in Thread] Current Thread [Next in Thread]