4 ms·
This article specifically discusses calling external C ABI libraries via the FFM API. GraalVM is for compiling JVM bytecode to native, architecture-specific bi
by gavinray 10mo ago
This article specifically discusses calling external C ABI libraries via the FFM API.
GraalVM is for compiling JVM bytecode to native, architecture-specific binaries.
FFM is like "[DllImport]" in .NET, or "extern" definitions in other languages.
The article shows how to auto-generate JVM bindings from C headers, and then allocate managed memory + interact with externally linked libs via the FFM API passing along said managed memory.
- fniephaus 10mo agoBTW: We (the GraalVM team) maintain a full-blown LLVM bitcode runtime that can be embedded in Spring or any other JVM application and compiled to native: https://github.com/oracle/graal/tree/master/sulong https://github.com/oracle/graal/tree/master/sulong
- gavinray 10mo agoMay as well throw the Native Image C API for FFM-like capabilities out there too https://www.graalvm.org/latest/reference-manual/native-image/native-code-interoperability/JNIInvocationAPI/ https://www.graalvm.org/latest/reference-manual/native-image... One of the neatest things I've been able to do is compile a .dll library "plugin" for an application which loads plug-ins by invoking a special exported symbol name like "int plugin_main()" using GraalVM and @CEntryPoint The entrypoint function starts a Graal isolate via annotation params and no native code was needed
- namegulf 10mo agoDon't we have JNI for that?