Clojure Rust GraalVM example updated: https://github.com/borkdude/clojure-rust-graalvm Now uses a Rust library to get the amount of free memory and displays it in EDN.
@retrogradeorbit Included your cool trick of storing the lib in ~/.clojure_rust
and loading it from there now:
https://github.com/borkdude/clojure-rust-graalvm/commit/2c0d01c771c67400f5cae4aa596e6e58b29bd897
@retrogradeorbit Where are the functions that you are calling from Clojure to C location in your source?
I mean the Clojure part calling into C
https://github.com/epiccastle/spire/blob/master/src/clj/spire/ssh_agent.clj#L58
for all of them just grep for SpireUtils
ah here you define the native things in Java: https://github.com/epiccastle/spire/blob/master/src/c/SpireUtils.java so it looks like you're also using JNA right?
not JNA, no. graal doesnt support JNA
sorry JNI
yep JNI
so SpireUtils.java is used to generate SpireUtils.h
JNI is more performant anyway, right?
yep. significantly more performant. but much more ceremony around it
JNA is almost magical.
header file is generated here:
https://github.com/epiccastle/spire/blob/master/Makefile#L74-L81
so in JDK8 there was a special tool javah
in JDK11 its bundled into javac
Awesome. I added this to the graal docs repo: https://github.com/lread/clj-graal-docs#interfacing-with-native-libraries If you have anything to add there, feel free.
I can add some stuff sure
I think adding the remarks about javah / javac could definitely be useful
Yeah I will write a quick summary for the C library case.
🙏 :thanks: