Well, if you think about it, this is what Gambit does internally - in a sexp  the symbol abcde is wrapped internally to (string->symbol "abcde").

In the C world, you could make a string->symbol wrapper so you'd get

___SCMOBJ alex_sy1 = string_to_symbol("alex_sy1");

etc.

With some C macro magic, perhaps that could even be written as

define_scheme_sy(alex_sy1)

or something.

(Also, have a look at string->symbol's definition, imaginably a lot of it is written in C in such a way that you could just call it directly from C, well, that might more probably not be an option too.)

2013/2/19 Alex Young <alex@blackkettle.org>
> 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.
>

Yeah, I was trying to avoid having to do this.  I'd be defining the
return codes twice - once as ints (or whatever) and once as symbols.  I
guess that's all macroable away, but still... not particularly elegant.

Thanks for the suggestions :-)

--
Alex
_______________________________________________
Gambit-list mailing list
Gambit-list@iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list