[racket] newbie: foreign C structure definition question

From: Hendrik Boom (hendrik at topoi.pooq.com)
Date: Thu Nov 18 21:44:40 EST 2010

On Tue, Nov 16, 2010 at 11:37:17PM -0500, Eli Barzilay wrote:
> Three minutes ago, Jay McCarthy wrote:
> > We could use a syntax parameter in define-cstruct to communicate to
> > the vector syntax to give them the correct size in structs and make
> > my macro's approach the normal behavior.
> 
> * Types in a cstruct are plain expressions (that should evaluate to
>   ctype values).
> 
> * Arrays should be available as a type outside of cstructs too.

An array of, say, ten elements should be passes the same way as a 
struct with the same ten elements.  That C doesn't do this is a 
flaw in its calling interface.  But given that it's possible to 
pass references, it should be possible to pass references to C 
arrays when the C funtion is coded as if it expects an array 
(when, of course, it really expects a reference).

That should clean up any inconvenience on the Scheme side of 
things,  But it's probably incompatible as all get out with 
existing practice.

-- hendrik

> 
> -- 
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                     http://barzilay.org/                   Maze is Life!
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users


Posted on the users mailing list.