anql
anql

Reputation: 39

What does the difference of the JNI method CallObjectMethod,CallObjectMethodV and CallObjectMethodA?

There are 3 kinds of methods in JNI CallObjectMethod CallObjectMethodV CallObjectMethodA So what does the difference of the methods?

jobject     (*CallObjectMethod)(JNIEnv*, jobject, jmethodID, ...);
jobject     (*CallObjectMethodV)(JNIEnv*, jobject, jmethodID, va_list);
jobject     (*CallObjectMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);

Upvotes: 2

Views: 8807

Answers (1)

Sergio
Sergio

Reputation: 8209

The only difference is the way how java arguments are passed. Docs explain all it very well:

Call<type>Method Routines

Programmers place all arguments that are to be passed to the method immediately following the methodID argument. The CallMethod routine accepts these arguments and passes them to the Java method that the programmer wishes to invoke.

Call<type>MethodA Routines

Programmers place all arguments to the method in an args array of jvalues that immediately follows the methodID argument. The CallMethodA routine accepts the arguments in this array, and, in turn, passes them to the Java method that the programmer wishes to invoke.

Call<type>MethodV Routines

Programmers place all arguments to the method in an args argument of type va_list that immediately follows the methodID argument. The CallMethodV routine accepts the arguments, and, in turn, passes them to the Java method that the programmer wishes to invoke.

Upvotes: 6

Related Questions