Commit 14ce6561 by Fear1ess

4/2

parent 0dfcd92b
...@@ -14,14 +14,6 @@ android { ...@@ -14,14 +14,6 @@ android {
versionName "1.0" versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
} }
buildTypes { buildTypes {
...@@ -30,12 +22,7 @@ android { ...@@ -30,12 +22,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.10.2"
}
}
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
......
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.10.2)
# Declares and names the project.
project("sdktestdemo")
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
native-lib.cpp )
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib} )
\ No newline at end of file
#include <jni.h>
#include <string>
extern "C" JNIEXPORT jstring JNICALL
Java_com_reyun_sdktestdemo_MainActivity_stringFromJNI(
JNIEnv* env,
jobject /* this */) {
std::string hello = "Hello from C++";
return env->NewStringUTF(hello.c_str());
}
\ No newline at end of file
...@@ -19,12 +19,11 @@ public class MainActivity extends AppCompatActivity { ...@@ -19,12 +19,11 @@ public class MainActivity extends AppCompatActivity {
// Example of a call to a native method // Example of a call to a native method
TextView tv = findViewById(R.id.sample_text); TextView tv = findViewById(R.id.sample_text);
tv.setText(stringFromJNI()); tv.setText("hello world!");
} }
/** /**
* A native method that is implemented by the 'native-lib' native library, * A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application. * which is packaged with this application.
*/ */
public native String stringFromJNI();
} }
\ No newline at end of file
...@@ -22,7 +22,6 @@ public class MyApplication extends Application { ...@@ -22,7 +22,6 @@ public class MyApplication extends Application {
public void onWdId(String wdId) { public void onWdId(String wdId) {
Log.d(TAG, "onWdId: " + wdId); Log.d(TAG, "onWdId: " + wdId);
} }
/* /*
@Override @Override
public void onError(String errorMsg) { public void onError(String errorMsg) {
......
...@@ -9,18 +9,18 @@ if(${CMAKE_ANDROID_ARCH_ABI} STREQUAL "arm64-v8a") ...@@ -9,18 +9,18 @@ if(${CMAKE_ANDROID_ARCH_ABI} STREQUAL "arm64-v8a")
wd_syscall64.s) wd_syscall64.s)
elseif (${CMAKE_ANDROID_ARCH_ABI} STREQUAL "armeabi-v7a") elseif (${CMAKE_ANDROID_ARCH_ABI} STREQUAL "armeabi-v7a")
set(ARCH_DEPENDED1_SRC set(ARCH_DEPENDED_SRC
wd_syscall32.s) wd_syscall32.s)
endif() endif()
set(CMAKE_CXX_FLAGS_RELEASE "-fvisibility=hidden -O3 -fno-unwind-tables") set(CMAKE_CXX_FLAGS_RELEASE "-fvisibility=hidden -O3 -fno-unwind-tables -flto")
add_library( add_library(
wdun wdun
SHARED SHARED
core.cpp core.c
wd_syscall.cpp wd_syscall.c
jni_helper.cpp jni_helper.c
${ARCH_DEPENDED_SRC} ${ARCH_DEPENDED_SRC}
) )
......
...@@ -15,15 +15,16 @@ IMPORTWDSYSCALL ...@@ -15,15 +15,16 @@ IMPORTWDSYSCALL
#define WDMAIN_GETWDID_METHOD_SIG "()Ljava/lang/String;" #define WDMAIN_GETWDID_METHOD_SIG "()Ljava/lang/String;"
jstring jni_get_wdid(JNIEnv* env, jobject thiz) { jstring jni_get_wdid(JNIEnv* env, jobject thiz) {
} }
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
int pid = WDSYSCALL(SYS_getpid); int pid = WDSYSCALL(SYS_getpid);
JNIEnv* env = NULL; JNIEnv* env = NULL;
if(vm->GetEnv((void**)&env, JNI_VERSION_1_6) == JNI_TRUE) { if((*vm)->GetEnv(vm, (void**)&env, JNI_VERSION_1_6) == JNI_TRUE) {
jclass cls = env->FindClass(WDMAIN_CLASS_NAME); jclass cls = (*env)->FindClass(env, WDMAIN_CLASS_NAME);
JNINativeMethod methods[] = {{WDMAIN_GETWDID_METHOD_NAME, WDMAIN_GETWDID_METHOD_SIG, (void*)jni_get_wdid}}; JNINativeMethod methods[] = {{WDMAIN_GETWDID_METHOD_NAME, WDMAIN_GETWDID_METHOD_SIG, (void*)jni_get_wdid}};
env->RegisterNatives(cls, methods, sizeof(methods)/sizeof(JNINativeMethod)); (*env)->RegisterNatives(env, cls, methods, sizeof(methods)/sizeof(JNINativeMethod));
} }
cJSON* json = cJSON_CreateObject(); cJSON* json = cJSON_CreateObject();
cJSON_AddStringToObject(json, "name", "zhanglei"); cJSON_AddStringToObject(json, "name", "zhanglei");
......
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
void wdCheckException(JNIEnv* env); void wdCheckException(JNIEnv* env);
char wdGetMethodRetType(const char* sig); char wdGetMethodRetType(const char* sig);
inline char wdGetFieldType(const char* sig) { return *sig; } char wdGetFieldType(const char* sig) { return *sig; }
jvalue wdGetStaticField(JNIEnv* env, const char* clsName, const char* fieldName, const char* fieldSig); jvalue wdGetStaticField(JNIEnv* env, const char* clsName, const char* fieldName, const char* fieldSig);
jvalue wdGetField(JNIEnv* env, jobject obj, const char* fieldName, const char* fieldSig); jvalue wdGetField(JNIEnv* env, jobject obj, const char* fieldName, const char* fieldSig);
void wdSetStaticField(JNIEnv* env, const char* clsName, const char* fieldName, const char* fieldSig, jvalue value); void wdSetStaticField(JNIEnv* env, const char* clsName, const char* fieldName, const char* fieldSig, jvalue value);
void wdSetField(JNIEnv* env, jobject obj, const char* fieldName, const char* fieldSig, jvalue value); void wdSetField(JNIEnv* env, jobject obj, const char* fieldName, const char* fieldSig, jvalue value);
jobject wdNewObject(JNIEnv* env, const char* clsName, const char* methodSig, ...); jobject wdNewObject(JNIEnv* env, const char* clsName, const char* methodSig, ...);
jvalue wdCallStaticMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, ...); jvalue wdCallStaticMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, va_list args);
jvalue wdCallMethod(JNIEnv* env, jobject obj, const char* methodName, const char* methodSig, ...); jvalue wdCallMethod(JNIEnv* env, jobject obj, const char* methodName, const char* methodSig, va_list args);
jboolean wdCallStaticBooleanMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, ...); jboolean wdCallStaticBooleanMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, ...);
jbyte wdCallStaticByteMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, ...); jbyte wdCallStaticByteMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, ...);
jchar wdCallStaticCharMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, ...); jchar wdCallStaticCharMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, ...);
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
#endif #endif
#define IMPORTWDSYSCALL \ #define IMPORTWDSYSCALL \
__attribute__((visibility("hidden"))) extern "C" int wd_syscall32(int cmd, ...);\ __attribute__((visibility("hidden"))) extern int wd_syscall32(int cmd, ...);\
__attribute__((visibility("hidden"))) extern "C" int wd_syscall64(int cmd, ...); __attribute__((visibility("hidden"))) extern int wd_syscall64(int cmd, ...);
extern "C" int wd_set_errno(int n); int wd_set_errno(int n);
#endif //REYUNSDK_WD_SYSCALL_H #endif //REYUNSDK_WD_SYSCALL_H
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#include "jni_helper.h" #include "jni_helper.h"
void wdCheckException(JNIEnv* env) { void wdCheckException(JNIEnv* env) {
if(env->ExceptionOccurred() != nullptr){ if((*env)->ExceptionOccurred(env) != NULL){
env->ExceptionDescribe(); (*env)->ExceptionDescribe(env);
env->ExceptionClear(); (*env)->ExceptionClear(env);
} }
} }
...@@ -23,257 +23,257 @@ char wdGetMethodRetType(const char* sig) { ...@@ -23,257 +23,257 @@ char wdGetMethodRetType(const char* sig) {
} }
jvalue wdGetStaticField(JNIEnv* env, const char* clsName, const char* fieldName, const char* fieldSig) { jvalue wdGetStaticField(JNIEnv* env, const char* clsName, const char* fieldName, const char* fieldSig) {
jclass cls = env->FindClass(clsName); jclass cls = (*env)->FindClass(env, clsName);
jfieldID fieldId = env->GetStaticFieldID(cls, fieldName, fieldSig); jfieldID fieldId = (*env)->GetStaticFieldID(env, cls, fieldName, fieldSig);
jvalue value = {0}; jvalue value = {0};
switch(wdGetFieldType(fieldSig)) { switch(wdGetFieldType(fieldSig)) {
case '[': case '[':
case 'L': case 'L':
value.l = env->GetStaticObjectField(cls, fieldId); value.l = (*env)->GetStaticObjectField(env, cls, fieldId);
break; break;
case 'Z': case 'Z':
value.z = env->GetStaticBooleanField(cls, fieldId); value.z = (*env)->GetStaticBooleanField(env, cls, fieldId);
break; break;
case 'B': case 'B':
value.b = env->GetStaticByteField(cls, fieldId); value.b = (*env)->GetStaticByteField(env, cls, fieldId);
break; break;
case 'C': case 'C':
value.c = env->GetStaticCharField(cls, fieldId); value.c = (*env)->GetStaticCharField(env, cls, fieldId);
break; break;
case 'S': case 'S':
value.s = env->GetStaticShortField(cls, fieldId); value.s = (*env)->GetStaticShortField(env, cls, fieldId);
break; break;
case 'I': case 'I':
value.i = env->GetStaticIntField(cls, fieldId); value.i = (*env)->GetStaticIntField(env, cls, fieldId);
break; break;
case 'J': case 'J':
value.j = env->GetStaticLongField(cls, fieldId); value.j = (*env)->GetStaticLongField(env, cls, fieldId);
break; break;
case 'F': case 'F':
value.f = env->GetStaticFloatField(cls, fieldId); value.f = (*env)->GetStaticFloatField(env, cls, fieldId);
break; break;
case 'D': case 'D':
value.d = env->GetStaticDoubleField(cls, fieldId); value.d = (*env)->GetStaticDoubleField(env, cls, fieldId);
break; break;
default: break; default: break;
} }
wdCheckException(env); wdCheckException(env);
env->DeleteLocalRef(cls); (*env)->DeleteLocalRef(env, cls);
return value; return value;
} }
jvalue wdGetField(JNIEnv* env, jobject obj, const char* fieldName, const char* fieldSig) { jvalue wdGetField(JNIEnv* env, jobject obj, const char* fieldName, const char* fieldSig) {
jclass cls = env->GetObjectClass(obj); jclass cls = (*env)->GetObjectClass(env, obj);
jfieldID fieldId = env->GetFieldID(cls, fieldName, fieldSig); jfieldID fieldId = (*env)->GetFieldID(env, cls, fieldName, fieldSig);
jvalue value = {0}; jvalue value = {0};
switch(wdGetFieldType(fieldSig)) { switch(wdGetFieldType(fieldSig)) {
case '[': case '[':
case 'L': case 'L':
value.l = env->GetObjectField(cls, fieldId); value.l = (*env)->GetObjectField(env, cls, fieldId);
break; break;
case 'Z': case 'Z':
value.z = env->GetBooleanField(cls, fieldId); value.z = (*env)->GetBooleanField(env, cls, fieldId);
break; break;
case 'B': case 'B':
value.b = env->GetByteField(cls, fieldId); value.b = (*env)->GetByteField(env, cls, fieldId);
break; break;
case 'C': case 'C':
value.c = env->GetCharField(cls, fieldId); value.c = (*env)->GetCharField(env, cls, fieldId);
break; break;
case 'S': case 'S':
value.s = env->GetShortField(cls, fieldId); value.s = (*env)->GetShortField(env, cls, fieldId);
break; break;
case 'I': case 'I':
value.i = env->GetIntField(cls, fieldId); value.i = (*env)->GetIntField(env, cls, fieldId);
break; break;
case 'J': case 'J':
value.j = env->GetLongField(cls, fieldId); value.j = (*env)->GetLongField(env, cls, fieldId);
break; break;
case 'F': case 'F':
value.f = env->GetFloatField(cls, fieldId); value.f = (*env)->GetFloatField(env, cls, fieldId);
break; break;
case 'D': case 'D':
value.d = env->GetDoubleField(cls, fieldId); value.d = (*env)->GetDoubleField(env, cls, fieldId);
break; break;
default: break; default: break;
} }
wdCheckException(env); wdCheckException(env);
env->DeleteLocalRef(cls); (*env)->DeleteLocalRef(env, cls);
return value; return value;
} }
void wdSetStaticField(JNIEnv* env, const char* clsName, const char* fieldName, const char* fieldSig, jvalue value) { void wdSetStaticField(JNIEnv* env, const char* clsName, const char* fieldName, const char* fieldSig, jvalue value) {
jclass cls = env->FindClass(clsName); jclass cls = (*env)->FindClass(env, clsName);
jfieldID fieldId = env->GetStaticFieldID(cls, fieldName, fieldSig); jfieldID fieldId = (*env)->GetStaticFieldID(env, cls, fieldName, fieldSig);
switch(wdGetFieldType(fieldSig)) { switch(wdGetFieldType(fieldSig)) {
case '[': case '[':
case 'L': case 'L':
env->SetStaticObjectField(cls, fieldId, value.l); (*env)->SetStaticObjectField(env, cls, fieldId, value.l);
break; break;
case 'Z': case 'Z':
env->SetStaticBooleanField(cls, fieldId, value.z); (*env)->SetStaticBooleanField(env, cls, fieldId, value.z);
break; break;
case 'B': case 'B':
env->SetStaticByteField(cls, fieldId, value.b); (*env)->SetStaticByteField(env, cls, fieldId, value.b);
break; break;
case 'C': case 'C':
env->SetStaticCharField(cls, fieldId, value.c); (*env)->SetStaticCharField(env, cls, fieldId, value.c);
break; break;
case 'S': case 'S':
env->SetStaticShortField(cls, fieldId, value.s); (*env)->SetStaticShortField(env, cls, fieldId, value.s);
break; break;
case 'I': case 'I':
env->SetStaticIntField(cls, fieldId, value.i); (*env)->SetStaticIntField(env, cls, fieldId, value.i);
break; break;
case 'J': case 'J':
env->SetStaticLongField(cls, fieldId, value.j); (*env)->SetStaticLongField(env, cls, fieldId, value.j);
break; break;
case 'F': case 'F':
env->SetStaticFloatField(cls, fieldId, value.f); (*env)->SetStaticFloatField(env, cls, fieldId, value.f);
break; break;
case 'D': case 'D':
env->SetStaticDoubleField(cls, fieldId, value.d); (*env)->SetStaticDoubleField(env, cls, fieldId, value.d);
break; break;
default: break; default: break;
} }
wdCheckException(env); wdCheckException(env);
env->DeleteLocalRef(cls); (*env)->DeleteLocalRef(env, cls);
} }
void wdSetField(JNIEnv* env, jobject obj, const char* fieldName, const char* fieldSig, jvalue value) { void wdSetField(JNIEnv* env, jobject obj, const char* fieldName, const char* fieldSig, jvalue value) {
jclass cls = env->GetObjectClass(cls); jclass cls = (*env)->GetObjectClass(env, cls);
jfieldID fieldId = env->GetFieldID(cls, fieldName, fieldSig); jfieldID fieldId = (*env)->GetFieldID(env, cls, fieldName, fieldSig);
switch(wdGetFieldType(fieldSig)) { switch(wdGetFieldType(fieldSig)) {
case '[': case '[':
case 'L': case 'L':
env->SetObjectField(obj, fieldId, value.l); (*env)->SetObjectField(env, obj, fieldId, value.l);
break; break;
case 'Z': case 'Z':
env->SetBooleanField(cls, fieldId, value.z); (*env)->SetBooleanField(env, cls, fieldId, value.z);
break; break;
case 'B': case 'B':
env->SetByteField(cls, fieldId, value.b); (*env)->SetByteField(env, cls, fieldId, value.b);
break; break;
case 'C': case 'C':
env->SetCharField(cls, fieldId, value.c); (*env)->SetCharField(env, cls, fieldId, value.c);
break; break;
case 'S': case 'S':
env->SetShortField(cls, fieldId, value.s); (*env)->SetShortField(env, cls, fieldId, value.s);
break; break;
case 'I': case 'I':
env->SetIntField(cls, fieldId, value.i); (*env)->SetIntField(env, cls, fieldId, value.i);
break; break;
case 'J': case 'J':
env->SetLongField(cls, fieldId, value.j); (*env)->SetLongField(env, cls, fieldId, value.j);
break; break;
case 'F': case 'F':
env->SetFloatField(cls, fieldId, value.f); (*env)->SetFloatField(env, cls, fieldId, value.f);
break; break;
case 'D': case 'D':
env->SetDoubleField(cls, fieldId, value.d); (*env)->SetDoubleField(env, cls, fieldId, value.d);
break; break;
default: break; default: break;
} }
wdCheckException(env); wdCheckException(env);
env->DeleteLocalRef(cls); (*env)->DeleteLocalRef(env, cls);
} }
jobject wdNewObject(JNIEnv* env, const char* clsName, const char* methodSig, ...) { jobject wdNewObject(JNIEnv* env, const char* clsName, const char* methodSig, ...) {
jclass cls = env->FindClass(clsName); jclass cls = (*env)->FindClass(env, clsName);
jmethodID methodId = env->GetMethodID(cls, "<init>", methodSig); jmethodID methodId = (*env)->GetMethodID(env, cls, "<init>", methodSig);
va_list args; va_list args;
va_start(args, methodSig); va_start(args, methodSig);
jobject res = nullptr; jobject res = NULL;
res = env->NewObjectV(cls, methodId, args); res = (*env)->NewObjectV(env, cls, methodId, args);
wdCheckException(env); wdCheckException(env);
va_end(args); va_end(args);
env->DeleteLocalRef(cls); (*env)->DeleteLocalRef(env, cls);
return res; return res;
} }
jvalue wdCallStaticMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, va_list args) { jvalue wdCallStaticMethod(JNIEnv* env, const char* clsName, const char* methodName, const char* methodSig, va_list args) {
jclass cls = env->FindClass(clsName); jclass cls = (*env)->FindClass(env, clsName);
jmethodID methodId = env->GetStaticMethodID(cls, methodName, methodSig); jmethodID methodId = (*env)->GetStaticMethodID(env, cls, methodName, methodSig);
jvalue value = {0}; jvalue value = {0};
switch(wdGetMethodRetType(methodSig)) { switch(wdGetMethodRetType(methodSig)) {
case 'V': case 'V':
env->CallStaticVoidMethodV(cls, methodId, args); (*env)->CallStaticVoidMethodV(env, cls, methodId, args);
break; break;
case '[': case '[':
case 'L': case 'L':
value.l = env->CallStaticObjectMethodV (cls, methodId, args); value.l = (*env)->CallStaticObjectMethodV (env, cls, methodId, args);
break; break;
case 'Z': case 'Z':
value.z = env->CallStaticBooleanMethodV(cls, methodId, args); value.z = (*env)->CallStaticBooleanMethodV(env, cls, methodId, args);
break; break;
case 'B': case 'B':
value.b = env->CallStaticByteMethodV(cls, methodId, args); value.b = (*env)->CallStaticByteMethodV(env, cls, methodId, args);
break; break;
case 'C': case 'C':
value.c = env->CallStaticCharMethodV(cls, methodId, args); value.c = (*env)->CallStaticCharMethodV(env, cls, methodId, args);
break; break;
case 'S': case 'S':
value.s = env->CallStaticShortMethodV(cls, methodId, args); value.s = (*env)->CallStaticShortMethodV(env, cls, methodId, args);
break; break;
case 'I': case 'I':
value.i = env->CallStaticIntMethodV(cls, methodId, args); value.i = (*env)->CallStaticIntMethodV(env, cls, methodId, args);
break; break;
case 'J': case 'J':
value.j = env->CallStaticLongMethodV(cls, methodId, args); value.j = (*env)->CallStaticLongMethodV(env, cls, methodId, args);
break; break;
case 'F': case 'F':
value.f = env->CallStaticFloatMethodV(cls, methodId, args); value.f = (*env)->CallStaticFloatMethodV(env, cls, methodId, args);
break; break;
case 'D': case 'D':
value.d = env->CallStaticDoubleMethodV(cls, methodId, args); value.d = (*env)->CallStaticDoubleMethodV(env, cls, methodId, args);
break; break;
default: break; default: break;
} }
wdCheckException(env); wdCheckException(env);
env->DeleteLocalRef(cls); (*env)->DeleteLocalRef(env, cls);
return value; return value;
} }
jvalue wdCallMethod(JNIEnv* env, jobject obj, const char* methodName, const char* methodSig, va_list args) { jvalue wdCallMethod(JNIEnv* env, jobject obj, const char* methodName, const char* methodSig, va_list args) {
jclass cls = env->GetObjectClass(obj); jclass cls = (*env)->GetObjectClass(env, obj);
jmethodID methodId = env->GetMethodID(cls, methodName, methodSig); jmethodID methodId = (*env)->GetMethodID(env, cls, methodName, methodSig);
jvalue value = {0}; jvalue value = {0};
switch(wdGetMethodRetType(methodSig)) { switch(wdGetMethodRetType(methodSig)) {
case 'V': case 'V':
env->CallVoidMethodV(obj, methodId, args); (*env)->CallVoidMethodV(env, obj, methodId, args);
break; break;
case '[': case '[':
case 'L': case 'L':
value.l = env->CallObjectMethodV (obj, methodId, args); value.l = (*env)->CallObjectMethodV (env, obj, methodId, args);
break; break;
case 'Z': case 'Z':
value.z = env->CallBooleanMethodV(obj, methodId, args); value.z = (*env)->CallBooleanMethodV(env, obj, methodId, args);
break; break;
case 'B': case 'B':
value.b = env->CallByteMethodV(obj, methodId, args); value.b = (*env)->CallByteMethodV(env, obj, methodId, args);
break; break;
case 'C': case 'C':
value.c = env->CallCharMethodV(obj, methodId, args); value.c = (*env)->CallCharMethodV(env, obj, methodId, args);
break; break;
case 'S': case 'S':
value.s = env->CallShortMethodV(obj, methodId, args); value.s = (*env)->CallShortMethodV(env, obj, methodId, args);
break; break;
case 'I': case 'I':
value.i = env->CallIntMethodV(obj, methodId, args); value.i = (*env)->CallIntMethodV(env, obj, methodId, args);
break; break;
case 'J': case 'J':
value.j = env->CallLongMethodV(obj, methodId, args); value.j = (*env)->CallLongMethodV(env, obj, methodId, args);
break; break;
case 'F': case 'F':
value.f = env->CallFloatMethodV(obj, methodId, args); value.f = (*env)->CallFloatMethodV(env, obj, methodId, args);
break; break;
case 'D': case 'D':
value.d = env->CallDoubleMethodV(obj, methodId, args); value.d = (*env)->CallDoubleMethodV(env, obj, methodId, args);
break; break;
default: break; default: break;
} }
wdCheckException(env); wdCheckException(env);
env->DeleteLocalRef(cls); (*env)->DeleteLocalRef(env, cls);
return value; return value;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment