Question

I've got a C function behind a c-lambda which needs to do some grubbing around with a select(2) call and decide on a scheme symbol to return as an indication of what it did, and whether an error condition occurred. How one gets hold of a named symbol as a ___SCMOBJ (or anything more appropriate) from C isn't explained in the docs, and the wiki seems to have fallen over. It's also not immediately obvious from gambit.h whether there's a macro for this purpose.

Is this possible out of the box? My workaround at the moment is to pass in returnable symbols as arguments to the function, but with a larger set of symbols I want to be able to return, that's going to get very unwieldy very quickly.

Was it helpful?

Solution

I asked this question on the gambit-c mailing list. There were three main responses:

  1. Export string->symbol to C
  2. Build a lookup table before calling into C
  3. Upgrade gambit

I'm going with (1) for the moment, because I want to be compatible with Debian Squeeze's gambit and I don't think the performance hit will be significant yet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top