<div><br></div><div>Symbols don't gc by default and they don't move, so their ___SCMOBJ representations remain constant across GC:s.</div><div><br></div><div>Does this solve your problem? (of course you modify get-sy to not be a function of an input argument but to perform your desired function and return the symbol return value based on the result reached.)</div>

<div><br></div><div>(c-declare "___SCMOBJ alex_symbols[123];")</div><div>(define upload-sy! (c-lambda (int scheme-object) void "alex_symbols[___arg1] = ___arg2;"))</div><div>(define get-sy (c-lambda (int) scheme-object "___result = alex_symbols[___arg1];"))</div>

<div><br></div>Mikael<br><br><div class="gmail_quote">2013/2/18 Alex Young <span dir="ltr"><<a href="mailto:alex@blackkettle.org" target="_blank">alex@blackkettle.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi there,<br>
<br>
I asked this question over on StackOverflow yesterday, but it's not had<br>
any joy so far.<br>
<br>
I've got a C function behind a c-lambda which needs to do some grubbing<br>
around with a select(2) call and decide on a scheme symbol to return as<br>
an indication of what it did, and whether an error condition occurred.<br>
Basically I want to use that symbol as a signal to drive a transition in<br>
a state machine.<br>
<br>
How one gets hold of a named symbol as a ___SCMOBJ (or anything more<br>
appropriate) from C isn't explained in the docs, and the wiki seems to<br>
have fallen over. It's also not immediately obvious from gambit.h<br>
whether there's a macro for this purpose.<br>
<br>
I've tried doing this:<br>
<br>
   (define (foo) 'bar)<br>
<br>
and taking a look at the C it generates, but it looks to me like<br>
following this pattern only works if you know the offset into the symbol<br>
table in advance.<br>
<br>
Is this possible out of the box?  My workaround at the moment is to pass<br>
in returnable symbols as arguments to the function, but with a larger<br>
set of symbols I want to be able to return, that's going to get very<br>
unwieldy very quickly.<br>
<br>
Thanks,<br>
<span class="HOEnZb"><font color="#888888">--<br>
Alex<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>
</font></span></blockquote></div><br>