4 ms·
yes, Java is adding jextract [1] as a replacement for JNI (Java Native Interface) which directly consumes header files using clang and produces a jar wrapping t
by _old_dude_ 5y ago
yes, Java is adding jextract [1] as a replacement for JNI (Java Native Interface) which directly consumes header files using clang and produces a jar wrapping the native calls.
It's not bolted in the compiler so less nice than Zig but the jar produced by jextract is not ABI dependent so more portable. The ABI dependent code is generated by the JIT using the the Foreign Linker API (the equivalent of C# DllImport) at runtime.
[1] https://inside.java/2020/10/06/jextract/ https://inside.java/2020/10/06/jextract/
- pjmlp 5y agoActually the equivalent of @dll.import from J++, funny how things turn out. https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa242534(v=vs.60) https://docs.microsoft.com/en-us/previous-versions/visualstu...
- MrBuddyCasino 5y agoThat code also contains a nice C parser that is handy, backed by LLVM. I recently switched from JNA to Panama for a project, and so far no regrets, other than having to mess with the Java module system.
- pjmlp 5y agoIt is already stable enough?
- MrBuddyCasino 5y agoToo early to tell. It clearly has received more care & attention so far than all the alternatives, so I’m not too worried about it being in „incubator“ status. The project lead knows his shit.