[plt-scheme] Manipulating Scheme vectors with FFI

From: Ernie Smith (esmith at acanac.net)
Date: Sat Nov 1 00:25:02 EDT 2008

Eli Barzilay wrote:
> On Oct 28, Benjamin Seppke wrote:
>   
>> So my question is: How can I manipulate Scheme vectors inside a c-
>> function and see the results of that in Scheme..?
>>     
>
> Generally speaking, you don't want to manipulate *Scheme* vectors --
> they hold data that your C library will not know how to handle.  The
> right solution is to translate a Scheme vector to a C vector and
> back.  Here's a few examples:
>
>   
Further to your comments on vectors in function parameter interfaces,  I 
have a question:

/*  vector as typedef   How to declare corresponding c-type in scheeme?  */
typedef int test_type[2];  


/* vector inside structure.  How to declare the same in Scheeme?  */
struct { int __val[ 2 ]; } ;  /* vector embedded in struct */

TIA



Posted on the users mailing list.