[gambit-list] How to pass a u8vector to the FFI

Álvaro Castro-Castilla alvaro.castro.castilla at gmail.com
Tue Mar 30 09:49:41 EDT 2010


El 30 de marzo de 2010 14:39, Mikael <mikael.trash at gmail.com> escribió:

> You do this, by declaring the passed u8vector as a scheme-object in the
> c-lambda definition.
>
> The memory pointer to the u8vector's contents in the C code is resolved by
>
>      void *u8vectorptr =
> ___CAST(void*,&___FETCH_U8(___BODY(theu8vectorschemeobjectvariable),___INT(0)));
>
> Remember that the pointer is only to be kept until the next return to
> Scheme.
>
>
Mikael
>


Thanks!! :)

May I ask where did you get this from? Gambit's source code? I can't find
docs about this...

Álvaro


>
> 2010/3/30 Álvaro Castro-Castilla <alvaro.castro.castilla at gmail.com>
>
>> Hi!
>>
>> Is there a way to pass a u8-vector to a FFI interface somehow?
>> The way I expect this to work is through a (pointer unsigned-char), but it
>> obviously doesn't work, claiming a proper C pointer. I would like to be able
>> to build this arrays from Scheme code. Is there a way?
>>
>> Currently I have to call a FFI function to set char by char, calling the
>> c-lambda function too many times.
>>
>> One thing that could work is something that converts u8-vectors to
>> unsigned char* arrays, does that exist in Gambit?
>>
>>
>> Thanks,
>>
>> Álvaro
>>
>> _______________________________________________
>> Gambit-list mailing list
>> Gambit-list at iro.umontreal.ca
>> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20100330/a1f33fc9/attachment.htm>


More information about the Gambit-list mailing list