-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jna extension #13054
Comments
I really don't think it's something we will want to do on our own. @stuartwdouglas WDYT? |
/cc @dmlloyd too as you might have insights on the GraalVM side. |
It's doable. GraalVM have said "no" (oracle/graal#673) but it should be possible as you say. |
@dufoli do you have a specific use case? |
Indeed it was because, I was thinking to the fact that java is not used compair to other language (python, ...) for machine learning. I discover deep java library and thinking that it can be awesome to have a neural network available on quarkus. I discover that there is someone who have work on it on apache/camel-quarkus#1598 |
Maybe we could have a Quarkiverse extension? I started one here just to play around with what would be involved: https://github.com/stuartwdouglas/quarkiverse-jna Unfortunately it is not going to be as simple as just registering some stuff for reflection. The first error that pops up is https://github.com/java-native-access/jna/blob/54c84a34f82d1e8148b0ed3808b64db4d1f79df3/src/com/sun/jna/internal/ReflectionUtils.java#L76 where they are using reflection to hack into method handle internals. It would be really cool to have neural networks on Quarkus, but at this stage it is hard to say how much work is involved. |
Riding the AI / ML wave in Quarkus would be awesome, but at this point I really think that any work in that direction should probably be done outside of Quarkus core. |
I don't have enough experience with jna, but it seems, that some kind of usage with graalvm is possible and example is on the way - oracle/graal#2261 (comment) |
@gastaldi can you create jna on quarkiverse and clone repo from mine (dufoli/quarkiverse-jna) . it is now failing with but it seems to be related to graalvm bug: |
@dufoli I created https://github.com/quarkiverse/quarkiverse-jna and gave you push access. Feel free to push your code there when it's usable. Thanks! Closing this issue now |
I have the full JNA configurations sample here if anyone is interested https://github.com/amahfouz1/jna-graalvm |
Me, I am working on extension but never finished it. |
@dufoli here you go the full configuration and it has been proven stable in production. Let me know if you need any help with the extension. |
@amahfouz1 Thank you for this! If this works, maybe it's possible to merge it upstream into JNA itself? All that JNA has to do is distribute these files in it's JAR, at the following location: And it should work for everyone. Would be awesome to have. |
graalvm do not support jna in native mode.
But JNA seems to be mainly a classic jar wich use a jni small subset to load native lib.
So my point is that maybe it is doable to use substitution + reflection identification + proxy identification to have jna support.
reference:
https://github.com/java-native-access/jna
quick analyse:
proxy:
https://github.com/java-native-access/jna/search?q=newproxyinstance
Reflections:
https://github.com/java-native-access/jna/blob/master/src/com/sun/jna/internal/ReflectionUtils.java
The text was updated successfully, but these errors were encountered: