Rust bindings to Racket C API
About Racket: https://racket-lang.org/.
- Base env:
Rusttoolchain,Clangtoolchain andRacketinstallation - Windows:
Visual Studio - MacOS:
Xcode CommandLine tools,iconv,ncurses - Linux:
- Only tested on Ubuntu 24.04
sudo apt install racket libncurses-dev,liblz4-dev,libzstd-dev
This crate includes a prebuilt Racket runtime for Windows, MacOS, and Linux.
- For Windows and MacOS, the bundled Racket comes from official Racket distribution.
- For Linux, the bundled Racket comes from Ubuntu APT.
Set environment variables (see below):
-
RACKET_CS_VERSION: Only for MacOS. If not set, default to8.15. -
RACKET_CS_HOME: Racket installation directory. If not set, default to:- Windows:
C:\Program Files\Racket - MacOS:
/Applications/Racket v{RACKET_CS_VERSION} - Linux:
/usr
- Windows:
-
helloworld examples/helloworld.rs:
cargo run --example helloworldscreenshot on Windows:
-
factorial examples/factorial.rs and examples/factorial.rkt:
This example demos how to require Racket module from Rust code.
cargo run --example factorialscreenshot on Windows:
Note: set env variable
RKT_COLLECTS_DIRtoracket installation/collects. For example, on MacOS:RKT_COLLECTS_DIR=/Applications/Racket\ v8.13/collects cargo run --example factorial
https://rn7s2.github.io/racket-sys/racket_sys/
Read https://docs.racket-lang.org/inside/cs-embedding.html for more information on how to embed Racket in your application.