Reputation: 12727
I keep seeing the env
interface pointer used with and without dereferencing, for example
env->DoSomething(arguments)
vs.
(*env)->DoSomething(env, arguments)
Are they actually different things? Is one from an older JNI implementation?
Upvotes: 1
Views: 267
Reputation: 19177
It's the difference between writing jni code in C and C++, from wikipedia:
Note that C++ JNI code is syntactically slightly cleaner than C JNI code because like Java, C++ uses object method invocation semantics. That means that in C, the env parameter is dereferenced using (*env)-> and env has to be explicitly passed to JNIEnv methods. In C++, the env parameter is dereferenced using env-> and the env parameter is implicitly passed as part of the object method invocation semantics.
Upvotes: 2
Reputation: 81684
They're the same thing; just a little macro magic. The nicer (first) syntax is enabled in a C++ context.
Upvotes: 3