diff --git a/interop/src/cpp/vmloader.cc b/interop/src/cpp/vmloader.cc index 41873d47668655390fcce12a3c32a440c7db9393..3c1750ab374e89c27a916445d8f8a38bea2b6433 100644 --- a/interop/src/cpp/vmloader.cc +++ b/interop/src/cpp/vmloader.cc @@ -63,11 +63,10 @@ const VMLibInfo javaVMLib = { const VMLibInfo pandaVMLib = { #if defined(KOALA_OHOS) #if defined(__arm) - #define SUFFIX "arm32" + "/system/lib" #else - #define SUFFIX "arm64" + "/data/storage/el1/bundle/libs/arm64" #endif - "/data/storage/el1/bundle/libs/" SUFFIX #else getenv("PANDA_HOME") #endif @@ -146,6 +145,8 @@ extern "C" DLL_EXPORT KInt LoadVirtualMachine(KInt vmKind, const char* appClassP return -1; } + createVM_t createVM = nullptr; + #ifdef KOALA_DYNAMIC_LOADER std::string libPath = #if defined(KOALA_LINUX) || defined(KOALA_MACOS) || defined(KOALA_WINDOWS) std::string(thisVM->sdkPath) + "/" + std::string(thisVM->platform) + "/" + libName(thisVM->lib) @@ -162,9 +163,18 @@ extern "C" DLL_EXPORT KInt LoadVirtualMachine(KInt vmKind, const char* appClassP return -1; } - auto createVM = (createVM_t)findSymbol(handle, thisVM->createVM); + createVM = (createVM_t)findSymbol(handle, thisVM->createVM); + #else + #ifdef KOALA_JNI + createVM = (createVM_t)JNI_CreateJavaVM; + #endif + #ifdef KOALA_ETS_NAPI + createVM = (createVM_t)ETS_CreateVM; + #endif + #endif + if (!createVM) { - fprintf(stderr, "Cannot find %s in %s\n", thisVM->createVM, libPath.c_str()); + fprintf(stderr, "Cannot find %s\n", thisVM->createVM); return -1; } @@ -209,6 +219,11 @@ extern "C" DLL_EXPORT KInt LoadVirtualMachine(KInt vmKind, const char* appClassP #if defined(KOALA_LINUX) {EtsOptionType::ETS_BOOT_FILE, (char*)strdup((std::string(thisVM->sdkPath) + "/ets/etsstdlib.abc").c_str())}, #endif + #if defined(KOALA_OHOS) + #if defined(__arm) + {EtsOptionType::ETS_BOOT_FILE, (char*)strdup((std::string(thisVM->sdkPath) + "/../etc/etsstdlib.abc").c_str())}, + #endif + #endif }; for (const std::string& path : files) { etsVMOptions.push_back({EtsOptionType::ETS_BOOT_FILE, (char*)strdup(path.c_str())});