layout | title | category | tags | order | |||
---|---|---|---|---|---|---|---|
developer-doc |
Rust |
infrastructure |
|
4 |
The Rust project is built using Cargo which manages dependencies between the
projects as well as external dependencies and allows for incremental
compilation. The build configuration is defined in
Cargo.toml
.
Although the entry point of the Enso project is a Java archive, it can still make use of native libraries built in Rust trough the JVM foreign function interface (FFI) named Java Native Interface (JNI).
In order to generate a shared library, the Cargo.toml
needs to enable
compilation into a dynamic system library:
crate-type = ["cdylib"]
Invoking cargo build
will then output the library into target/rust/debug
with the extension .so
on Linux, .dll
on Windows and .dylib
on macOS.
Then, to be able to load the library by System.loadLibrary("lib_name")
, the
Java application should be started with the option
-Djava.library.path=path/to/lib_folder
.