<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Is it that.. you find it tricky to get in place a particular sequence of C FFI structure release function invocation on their GC???</div>
<div></div></div></blockquote><div><br></div><div>It's not tricky if you know what you're doing.  But if you are going to publish a library that exposes C bindings, you really don't want to have to be warning people against holding weak references to these foreign objects, lest they get a segfault or memory corruption.<br>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>Something along the lines that if you have a C structure A that contains in it a reference to another C structure B, and you want Gambit's GC to automatically take care of this relationship in the sense that it will not release B before A??</div>
</div></blockquote><div><br></div><div dir="ltr">Yes, with the nuance that the C structure B is contained in A, not just referenced from it.  So it doesn't make sense to free B at all.  Another use case is that A is a union and B is another pointer to A's data.  You want to free A only once.  <br>
<br>But yes, the main point is that you want A to stick around while you have a reference to B.  This kind of sanity you take for granted in the Scheme world, thanks to garbage collection.  What I want is to be able to treat C objects similarly, without having to do unnecessary copies.<br>
 <br></div></div></div></div>