Hi Alvaro,<div><br></div><div>You can traverse all Scm structures from C.</div><div><br></div><div>You have typecheckers, car, cdr, vector-ref, accessors for all the specialized vector types and so on.</div><div><br></div>

<div>In the current Gambit version, from all I know, using these works perfectly.</div><div><br></div><div>As soon as Gambit goes SMP, this may be a slightly other story and only the objects specifically allocated with ___STILL may be safe to use, we'll see when we get there. What could be an issue would be that the GC would trig during your C call and change all the other object references to an object and then its physical memory location, and you'd be using the old one in your C code.</div>

<div><br></div><div>Do you have a specific question or problem to solve?</div><div><br></div><div>Brgds,</div><div>Mikael<br><br><div class="gmail_quote">2013/4/12 Álvaro Castro-Castilla <span dir="ltr"><<a href="mailto:alvaro.castro.castilla@gmail.com" target="_blank">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 dir="ltr">There is one thing that I've been meaning to ask for a long time now.<div><br></div><div>I see most of the people tend to create arrays in C by malloc/___alloc_rc and then assigning values by iterating over them via a setter function (also defined with c-lambda).</div>



<div>Isn't there a way to directly do this with a memcpy operation? Wouldn't that be faster?</div><div><br></div><div>I understand that Gambit's heap and C's heap are separate, and you need to copy from one another in order to avoid GC touching any of FFI-created memory. But is it possible to improve this process using some sort of C function/macro from Gambit?</div>



<div><br></div><div>I really can't find any code examples or reference for this.</div><div><br></div><div>Thank you very much.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Álvaro</div></font></span></div>


<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>