1. bool JniInvocation::Init(const char* library) {
2.
#ifdef HAVE_ANDROID_OS
3. char default_library[PROPERTY_VALUE_MAX];
4. property_get(
"persist.sys.dalvik.vm.lib"
, default_library,
"libdvm.so"
);
5.
#else
6. const char* default_library =
"libdvm.so"
;
7.
#endif
8.
if
(library == NULL) {
9. library = default_library;
10. }
11. handle_ = dlopen(library, RTLD_NOW);
12. ......
13.
if
(!FindSymbol(reinterpret_cast<void**>(&JNI_GetDefaultJavaVMInitArgs_),
14.
"JNI_GetDefaultJavaVMInitArgs"
)) {
15.
return
false
;
16. }
17.
if
(!FindSymbol(reinterpret_cast<void**>(&JNI_CreateJavaVM_),
18.
"JNI_CreateJavaVM"
)) {
19.
return
false
;
20. }
21.
if
(!FindSymbol(reinterpret_cast<void**>(&JNI_GetCreatedJavaVMs_),
22.
"JNI_GetCreatedJavaVMs"
)) {
23.
return
false
;
24. }
25.
return
true
;
26. }