That seems like a pretty clunky interface. But I assume from the way that everything is spelled out explicitly that it's made to be performant. And obviously it's a big improvement over JNI.

This is the runtime API, that uses the JITs to generate the trampoline codes necessary to go from the Java calling convention to the C calling convention (upcall and downcall), a kind of like libffi for Java.

If you have a typed langages like Scala, Kotlin, Java, you can use jextract [1] which is a more high level API. jextract uses clang to parse C headers files and generates a jar file with all the C function seen as Java methods with all the glue generated for you (the downside is i believe that this jar is OS specific).

This API is more for dynamic languages like Clojure, Groovy, JRuby, where you want to do dynamic runtime calls and still get performance (as far as i understand, the JIT generates the adapter code once per call and you can reuse it).

[1] https://github.com/openjdk/jextract