Introduction ------------ This is some experiments with the panama-foreign abi JEP for invoking native C functions from Java directly and without JNI. The main goal is to experiment with creating a "java friendly" and mostly type-safe api directly in one step, without requiring additional wrapping or inconvenient use. It's roughly tracking the openjdk repository of the same date. It uses a gcc plugin to compile the headers to obtain most of the api information, but requires cpp and perl to extract the values of #define constants. This api information is then converted to Java wrappers using a config-directed perl script `generate-native'. The config is flexible enough to either generate c-like libraries of static functions or object-oriented layouts with data, static and object functions grouped by class. test-vulkan uses a different approach as the vulkan api is officially defined by an xml registry and not the generated C headers. This is directly converted to about-as-java-friendly a vulkan api as one can hope for (all those structs you need to initialise get messy in any language). Most of the script is converting the registry vk.xml file into a usable structure as it's really only designed for outputting c headers. Compile ------- Requirements are gcc and cpp, perl, GNU make. First run make in src. See test-*/* for examples. JAVA_HOME must point to a compatible panama-enabled jdk. Status ------ It's all work in progress of course. * bitfields not implemented yet. * varargs is not implemented. * the support library in Memory.java is copied to each output api, but should be global. * the scope and object lifecycle stuff is not really sorted out yet. License ------- GNU General Public License, version 3 or later, but see individual file headers for specifics. Links ----- * https://www.zedzone/software/panamaz.html - project page. * https://openjdk.java.net/projects/panama - openjdk panama page. * https://github.com/openjdk/panama-foreign - openjdk panama source.