<div dir="ltr">Estevo,<div><br></div><div>To get where you are at now - at the current point, are you happy with what Gambit does right now, or are you still seeing an issue?</div><div><br></div><div>If so, can you provide like a three-line example illustrating the problem and how it could be resolved?</div>

<div><br></div><div>Happy Holidays,</div><div>Mikael</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/24 Estevo <span dir="ltr"><<a href="mailto:euccastro@gmail.com" target="_blank">euccastro@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"><div><div><div><div class="im">>> I've experimented in the past with making a macro that would generate the<br>


>> appropriate ffi code to create and manage c structs/unions/types.  The<br>
>> challenge was to handle references obtained from accessors to fields<br>
>> containing other structs/union/types within them in such a way that<br>
>> - no copying was necessary, and<br>
>> - the original structure wouldn't be released as long as derived references<br></div><div class="im">
>> existed<br>
><br>
> Anyone know what guile does?  If anything?<br>
><br>
> -- hendrik<br><br></div></div>Well, I was interested in how to make it work in Gambit as is.  If we consider modifications to Gambit, there is an easy solution: give foreign objects a 'data' field that holds a user-settable strong reference to a Scheme object.  Then, whenever you need to make sure that object A is not reclaimed while foreign object B is reachable, you just say (foreign-data-set! B A).<br>


<br></div>Indeed, after having tried hard, my current impression is that the above can't be done in a way that is robust and seamless to the user without modifying Gambit.  I'd be very happy to be proven wrong in this!<br>


<br>I have made a pull request proposing that change:<br><br><a href="https://github.com/feeley/gambit/pull/59" target="_blank">https://github.com/feeley/gambit/pull/59</a><br><br></div>but I don't know whether the cost of one extra pointer per foreign object is a showstopper here.<br>


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