[racket] newbie: foreign C structure definition question

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Nov 4 00:59:15 EDT 2010

Currently the FFI does not support this.

I've simulated it in the past by making another struct with 32 char objects.

I wrote a macro to automate it. Look at

define-opencl-vector-alias

from

https://github.com/jeapostrophe/opencl/blob/master/c/tsyntax.rkt

A use case:

(define-opencl-vector-alias _cl_char 16)

defines

_cl_char16

as a struct with 16 _cl_chars

Jay

On Wed, Nov 3, 2010 at 10:45 PM, John Whittaker
<john.whittaker at kc.rr.com> wrote:
> Hi Racket users,
>
> I am new to Racket Scheme, but not new to Scheme in general.
>
> I am trying to figure out how/if I can create a Racket C foreign
> structure representation of the following simple C struct using
> define-cstruct:
>
> struct X
> {
>   int p1;
>   char s1[32];
> };
>
>
> It is the nested array that I cannot figure how to represent.  I have
> tried combing the Racket Guide and searched examples on the net, but I
> have not found anything.  Does Racket support this or have I got too
> much newbie ignorance?
>
> Thanks,
>
> John Whittaker
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.