gpt4 book ai didi

java - JNI方法CallObjectMethod、CallObjectMethodV和CallObjectMethodA有什么区别?

转载 作者:行者123 更新时间:2023-11-30 01:42:43 26 4
gpt4 key购买 nike

JNI中有3种方法调用对象方法调用对象方法V调用对象方法A那么这些方法有什么区别呢?

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

最佳答案

唯一的区别是 java 参数的传递方式。 Docs很好地解释这一切:

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.

关于java - JNI方法CallObjectMethod、CallObjectMethodV和CallObjectMethodA有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39203288/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com