Buoy - fast & clean native interop with Panama

As pretty much everyone here knows, interop between Java & native code has always been kind of a pain - if you’re lucky enough to have a good binding you’re in good shape, but if nobody has made a binding yet (or you have a binding but it’s poor quality) you’re stuck writing JNI code. With the JDK’s Project Panama out of incubation and available as a preview feature, the situation is a lot better - you don’t have to resort to JNI because you can create bindings purely in Java, but Panama is a low-level and quite verbose API. That’s where Buoy comes into the picture - it’s a very high-level, declarative library that allows you to define bindings in pure Java (optionally with nothing more than some annotations) with very little code. It also supports injecting native function handles, global and struct field accessors, and struct pointers into Java object fields (mapping).

Just like Panama itself, Buoy is in its early stages and will be undergoing further evolution before being ready for real-world use. However, if anyone’s interested in checking out the concept or kicking the tires a bit, it’s available at MyWorldLLC/Buoy: Simple and clean native binding library for Java (github.com). I’d appreciate any feedback!

8 Likes