The Project Panama (OpenJDK: Panama), a Java native Foreign Function Interface which eventually will supersede JNI, is looking for help. They’re searching for all kinds of real world use cases of JNI to cover as much situations as possible.
If you use JNI please help. If you like you can post your use cases directly to the Panama mailing list or to Dan Heidinga (https://twitter.com/DanHeidinga).
Pah, who is using JNI at all? Oh, wait…
At the moment, there does not seem to be any real discussion of use-cases at the mailing list - only the commit logs…
Interestingly, there once was a site about JNI and native function calling at sun.com - but it seems that it did not survive the transition to Oracle. I had to use the web archive in order to have another look at the link (that has been lying around on my desktop for many, many years) : Leveraging Existing Native Libraries It shows a „generic“ way of calling arbitrary native functions with „Shared Stubs“ (I guess, something like this (in a far more sophisticated form) is used in JNA …))
@saudet Might also be interested in this.
For those things you should use JNR which is faster than JNA (spins native assembler code at runtime to bind the calls which is pretty much what will go into the JVM). Just hook up Dan at twitter, he’ll appreciate it!
Performance is only one aspect. There are dozens of ways for accessing or leveraging native libraries. Many of them are listed at https://github.com/bytedeco/javacpp . And for most of them, the weak point is not performance (particularly when they just make generating JNI code a bit more convenient), but others - e.g. that they are generating unreadable code, or don’t support any C++ features.
If “hook up” means “to follow”: I think my cell phone does not support twitter :sick: (seriously, I don’t get this - but I joined the mailing list. This 90’s tech is more my style :D)
Thanks for the heads up! I’m already sort of “participating”, but whenever I mention anything related to C++ on the mailing list, I get blank stares, so I’m not sure to what point they are really serious about supporting C++. It looks like they are basically inserting https://github.com/jnr into the JDK, providing the equivalent of P/Invoke for the JVM, which is great, but it won’t work for C++.
If you have more info, I would certainty be interested in hearing about it. Thanks!
Just another pointer: One should probably watch https://www.youtube.com/watch?v=d4B8sc7ltZk before getting involved in a discussion - just to know what they already have considered and planned.
Yeah thanks Marco, forgot to share this talk
C++ is a big problem to support. I’m pretty sure they would love to do that but there is no such calling convention as it is for C. That said every C++ compiler does it’s own rules for name mangling and stuff. The reason why, for example D, also just has the option to call into C++ code compiled by the Digital Mars compiler.
There doesn’t seem to be any discussion at the mailing list anyhow. I’d somehow feel stupid to now just drop in and say "Hey, folks, I’m doing JNI stuff, too, let me talk about things that you already considered yeeears ago: … " :o
Write Dan on twitter as proposed. Best way to get the discussion going.