I've been working with JNA on Android to wrap some image manipulation libraries.
Because I need to interoperate with Bitmaps I ended up wrapping this NDK library (which I'd be happy to contribute to jna-platform).
Those functions, however, demand a JNIEnv pointer (they're supposed to be used with JNI).
This feature request harks back to java.net issue 53 (link to the discussion, java.net is retired).
That ended up with JNA adding support for passing Java objects (OPTION_ALLOW_OBJECTS) which was absolutely necessary for my use case (so thanks) but no official/clean API to get JNIEnv.
The code in the comments set me on the right track to also get JNIEnv but it feels a bit like a cludge. For the record this is what I'm doing.
A public static method on Native seems much cleaner/portable and neither overly complicated nor a maintenance burden.
Given what I guess is a valid use case (Android bindings for stuff in the NDK), would you consider the inclusion of such a method?
I've been working with JNA on Android to wrap some image manipulation libraries.
Because I need to interoperate with Bitmaps I ended up wrapping this NDK library (which I'd be happy to contribute to jna-platform).
Those functions, however, demand a JNIEnv pointer (they're supposed to be used with JNI).
This feature request harks back to java.net issue 53 (link to the discussion, java.net is retired).
That ended up with JNA adding support for passing Java objects (
OPTION_ALLOW_OBJECTS) which was absolutely necessary for my use case (so thanks) but no official/clean API to get JNIEnv.The code in the comments set me on the right track to also get JNIEnv but it feels a bit like a cludge. For the record this is what I'm doing.
A public static method on
Nativeseems much cleaner/portable and neither overly complicated nor a maintenance burden.Given what I guess is a valid use case (Android bindings for stuff in the NDK), would you consider the inclusion of such a method?