4 ms·
I've never played with Java's FFI, but now that we have these "cosmopolitan" native executables that run on all platforms - would it be possible to link one cop
by geokon 4y ago
I've never played with Java's FFI, but now that we have these "cosmopolitan" native executables that run on all platforms - would it be possible to link one copy of a large native library (ex: OpenCV or Intel MKL) and then not worry or think about platform specifics?
And how does this all play with GraalVM native compilation? Could I still compile a native executables after using this FFI?
Then you could go full circle and get a native exectable that's cosmopolitan ...
- kaba0 4y agoAfaik cosmopolitan is only meaningful for executable startups, the actual x86 binaries can be platform-agnostic, but only if they basically do no communication with the outside world (or very little), since otherwise they have to use OS APIs. So, not sure that the same version can be linked, but most libraries have a shared API with platform-specific implementations and one can just link against them, pretty much how it is done today in e.g. Blender. GraalVM is a bit trickier as it can be used to interpret LLVM bytecode, which will be portable across OSs, both when native compiled or when used on top of JVM. But if it uses Panama it would get the aforementioned limitations as it is basically just a wrapper over dynamically wrapping libs.