Is there a way to have C run scheme programs? I know both languages and was hoping to use the logic of scheme with the speed of C. A basic example C makes the lists that scheme needs to use then scheme returns something. So far I have been using DrRacket for scheme. Can anyone point me in the right direction?
edit:
Looking at Caleb's answer I saw Racket CGC. How do you find this I have the racket source from its website, I am on Ubuntu. And where can i get the libracket.a and libmzgc.a libraries. I can't find them anywhere. Everywhere I look it just points back to the article saying you need them.
The simplest way of mixing Scheme and C is to write the main program in Scheme and only write what absolutely needs to be in C in C.
The C source is compiled as a library, and then it is imported in Racket using the FFI. The FFI is surprisingly easy to use, and even if you decide to write your program the other way around, is definitely something you should examine first.
Introduction to the FFI
Docs on the FFI
Btw - libracket.a and libmzgc.a should be installed along with the rest of the Racket files. I am not on Ubuntu, so I don't know the exact path. However you can use the unix command find
to locate it.
If I remember correctly, the command is:
find / -name libracket.a
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With