1.4 KiB
1.4 KiB
Rust Call Lean
A tiny example of calling Lean's FFI from Rust with Nix.
This is based on:
Usage
Since the entire environment was built on Nix flakes, the easiest way to run the executable is via Nix:
$ nix run .#caller
For interactive development, one can also drop into a develop shell:
$ nix develop
and then execute
$ cargo run
Execution without Nix is possible.
This project has been tested on Linux and Mac OS.
Structure
The project has 2 parts:
Callee
, a Lean libraryCaller
, a Rust executable
Caller
is dependent on Callee
and requires it along with Lean to be present
in the environment for linking. Specifically the following environment variables
must be set:
CALLEE_PATH
: Path to a directory containinglibCallee.so
LEAN_ROOT
: Path to a directory such that$LEAN_ROOT/include
has lean headers and$LEAN_ROOT/lib
has theleanshared
library- Clang path must be set so
clang-sys
can find it - Clang executable must be present in
PATH