How I might go about embedding Racket CS in a fairly big C codebase, about 
100KLOC big. It is exceptionally well written C authored by people who knew 
what they were doing. I am sadly not one such person, so I'd rather not 
muddy things with my exceptionally terrible C. C code will be driving the 
whole application, which means it'll be the one to call into Racket. Since 
I'd rather not re-implement the whole thing in Racket I'd probably have it 
call back into C for the things implemented there, so I'll have to program 
Racket bindings for at least the things I care in the C library. That's the 
task at hand.

I managed to embed Gambit so I can now have my nested call bonanza: C 
initializes Scheme, invokes Scheme procedures some of which call back into 
C etc. Gambit makes it mostly straightforward. I can certainly make do with 
Gambit, but it'd be nice to have access to Racket batteries, its macro 
bazooka and, you know, actual documentation, so I am eager to try. I 
imagine it'll be quite the workout with CS. I am specifically interested in 
doing this with Chez version, not the C API of the main system, unless our 
plan is to offer the same FFI in Racket CS.

Looking at racket/src/cs/Makefile it builds racket.so, which I suppose I 
can link. It wouldn't offer anything in terms of C FFI yet, right? But I 
bet it links Chez. I wonder if I could lean on its C API which Chez docs 
make out to be nice enough. I could maybe wrap the C API I care about in a 
Chez library, compile and link it, then compile and load Racket user code 
that calls the wrapper compiled from Scheme? Would that be hard? How chummy 
is Racket with Chez, really? Is indirection through Chez the way to go atm?

Is there a more straightforward way to embed Racket and have it as an 
extension language?

Have I wondered into "keep out unless Matthew" territory?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/156514ed-cae3-4cb4-8768-97be8c88c16c%40googlegroups.com.

Reply via email to