Hi Alvaro,
You can traverse all Scm structures from C.
You have typecheckers, car, cdr, vector-ref, accessors for all the specialized vector types and so on.
In the current Gambit version, from all I know, using these works perfectly.
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.
Do you have a specific question or problem to solve?
Brgds, Mikael
2013/4/12 Álvaro Castro-Castilla alvaro.castro.castilla@gmail.com
There is one thing that I've been meaning to ask for a long time now.
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). Isn't there a way to directly do this with a memcpy operation? Wouldn't that be faster?
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?
I really can't find any code examples or reference for this.
Thank you very much.
Álvaro
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list