<p dir="ltr"><br>
On Feb 18, 2013 11:21 AM, "Alex Young" <<a href="mailto:alex@blackkettle.org">alex@blackkettle.org</a>> wrote:</p>
<p dir="ltr">> 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>
></p>
<p dir="ltr">I think there are a couple of ways you can do this:</p>
<p dir="ltr">1) c-define a Scheme procedure that returns the symbols you're interested in based on some parameter. In the most general case it could be just a wrapper around string->symbol.</p>
<p dir="ltr">2) you're returning symbols so I think you want your C function to return to Scheme. Have your C function return a result code and wrap it in a Scheme procedure that maps the result code onto a symbol. You can look at Gamsock on the dumping ground for examples of how to wrap a low-level C function in a Scheme procedure that handles the Scheme objects.</p>