Get the latest tech news

Writing C code in Java/Clojure: GraalVM specific programming (2021)


One of the latest fashions in the Java world is GraalVM. For someone who has been around, I still remember the "Write once, run anywhere" slogan of Java virtual machine. Apparently, the wheel has spun back, now people want to write native code in Java, which has to be compiled …

The small but vibrant Clojure community, which I consider myself a part of, is particularly excited about this new found capability of JVM, for we now have one more way to write quick starting command line programs using our beloved language. For an opaque C struct declaration that does not list its fields, one must add an isIncomplete option to the annotation, otherwise compilation will fail with a "sizeOf" related error. So writing a thin layer of wrapper for these GraalVM word types seems to be inevitable, unless Clojure can be enhanced to be more native image programming friendly.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of GraalVM

GraalVM

Photo of C code

C code

Photo of specific programming

specific programming