You do this, by declaring the passed u8vector as a scheme-object in the c-lambda definition.<div><br></div><div>The memory pointer to the u8vector's contents in the C code is resolved by</div><div><br></div><div><div>     void *u8vectorptr = ___CAST(void*,&___FETCH_U8(___BODY(theu8vectorschemeobjectvariable),___INT(0)));</div>
<div><br></div><div>Remember that the pointer is only to be kept until the next return to Scheme.</div><div><br></div><div>Mikael</div><br><div class="gmail_quote">2010/3/30 Álvaro Castro-Castilla <span dir="ltr"><<a href="mailto:alvaro.castro.castilla@gmail.com">alvaro.castro.castilla@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>Hi!<br></div><div><br></div><div>Is there a way to pass a u8-vector to a FFI interface somehow?</div><div>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?</div>


<div><br></div><div>Currently I have to call a FFI function to set char by char, calling the c-lambda function too many times.</div><div><br></div><div>One thing that could work is something that converts u8-vectors to unsigned char* arrays, does that exist in Gambit?</div>


<div><br></div><div><br></div><div>Thanks,</div><div><br></div><font color="#888888"><div>Álvaro</div>
</font><br>_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
<br></blockquote></div><br></div>