[racket] newbie: foreign C structure definition question

From: John Whittaker (john.whittaker at kc.rr.com)
Date: Tue Nov 16 23:06:33 EST 2010

Sorry.

I forgot to say this last week when you replied: Thanks for the info!

It is a bit surprising to me that the FFI does not support arrays.  Is
this on the list of future functionality?

Thanks again,

John Whittaker


On 11/03/2010 11:59 PM, Jay McCarthy wrote:
> 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
>>
> 
> 
> 



Posted on the users mailing list.