Skip to content
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

Provide a way to get JNIEnv pointer #805

Closed
ncruces opened this issue May 15, 2017 · 0 comments
Closed

Provide a way to get JNIEnv pointer #805

ncruces opened this issue May 15, 2017 · 0 comments

Comments

@ncruces
Copy link
Contributor

ncruces commented May 15, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant