I want to call dalvik's openDexFile() function from JNI. I see it is exported as index "1" as static function in dalvik/vm/native/dalvik_system_DexFile.cpp--const DalvikNativeMethod dvm_dalvik_system_DexFile[] = { { "openDexFile", "(Ljava/lang/String;Ljava/lang/String;I)I", Dalvik_dalvik_system_DexFile_openDexFile }, { "openDexFile", "([B)I", Dalvik_dalvik_system_DexFile_openDexFile_bytearray }, { "closeDexFile", "(I)V", Dalvik_dalvik_system_DexFile_closeDexFile }, { "defineClass", "Ljava/lang/String;Ljava/lang/ClassLoader;I)Ljava/lang/Class;", Dalvik_dalvik_system_DexFile_defineClass }, { "getClassNameList", "(I)[Ljava/lang/String;", Dalvik_dalvik_system_DexFile_getClassNameList }, { "isDexOptNeeded", "(Ljava/lang/String;)Z", Dalvik_dalvik_system_DexFile_isDexOptNeeded }, { NULL, NULL, NULL }, };I'm trying to figure out what is the syntax to call this function from JNI and what header files (if any) do I need to include to get this dalvik structure defined in my JNI code. During my search, I locatedsomething similar in Appendix "A" of this write-up http://net.cs.uni-bonn.de/fileadmin/user_upload/plohmann/2012-Schulz-Code_Protection_in_Android.pdf but I am not sure what to include to get this JNI code to compilejint Java_com_test_mainactivity_openDexFile( JNIEnv* env, jobject thiz, jbyteArray dexData) { jvalue pResult; jint result; u4 args[] = {(ArrayObject*)dexData}; <<<< is "u4" from dalvik\common.h? What is ArrayObject? dvm_dalvik_system_DexFile[1].fnPtr(args, &pResult); <<<< how do I declare dvm_dalvik_system_DexFile?
result = pResult.l; return result; }Any help is appreciated. Thanks!
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.