Fork me on GitHub
#graalvm
<
2020-02-27
>
borkdude11:02:26

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.

borkdude13:02:06

@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

👍 4
borkdude13:02:47

@retrogradeorbit Where are the functions that you are calling from Clojure to C location in your source?

borkdude13:02:15

I mean the Clojure part calling into C

Crispin13:02:53

for all of them just grep for SpireUtils

borkdude13:02:38

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?

Crispin13:02:40

not JNA, no. graal doesnt support JNA

Crispin13:02:24

so SpireUtils.java is used to generate SpireUtils.h

zilti13:02:32

JNI is more performant anyway, right?

Crispin13:02:24

yep. significantly more performant. but much more ceremony around it

Crispin13:02:42

JNA is almost magical.

Crispin13:02:52

header file is generated here:

Crispin13:02:10

so in JDK8 there was a special tool javah

Crispin13:02:22

in JDK11 its bundled into javac

borkdude13:02:06

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.

Crispin13:02:13

I can add some stuff sure

borkdude14:02:51

I think adding the remarks about javah / javac could definitely be useful

Crispin14:02:07

Yeah I will write a quick summary for the C library case.

borkdude16:02:01

🙏 thanks

👌 4