I am using the NativeActivity from C. My goal is to get a reference to a JNIEnv so I can make further Android calls.
Going by the examples I have gathered on the Android documentation and Stackoverflow, I keep seeing this
state->activity->vm->AttachCurrentThread(&env, NULL);```
But I keep getting this error...
error: member reference base type 'JavaVM' (aka 'const struct JNIInvokeInterface *') is not a structure or union
You need to dereference your "pointer to a JavaVM pointer".
This will work:
Since you are using C, the function signature will also be different since you need to also pass in a pointer to the JavaVM.
Try this:
It looks like you are calling from C, and not C++. In that case there is a typedef for JavaVM to the JNIInvokeInterface pointer.
Here's the header definition for that type (jni.h)
Using a C compiler, you are calling functions on a pointer to a pointer, which is causing your described error: "not a structure or a union".
But the examples your using are for a C++ compiler, which as you can see in the header definition, is typedef'ed to a struct instead.
C usage is a bit different from C++