1
#include "load-library.h"
2
#include "arkoala-logging.h"
4
#if defined(KOALA_WINDOWS)
7
// Here we need to find module where GetArkAnyAPI()
8
// function is implemented.
12
HMODULE result = nullptr;
13
const char libname[] = "./native/ace_compatible_mock.dll";
14
result = LoadLibraryA(libname);
18
LOG("Cannot find module!");
24
extern "C" void* GENERATED_GetArkAnyAPI(int kind, int version);
26
void* FindFunction(void* library, const char* name)
29
return (void*)GetProcAddress(reinterpret_cast<HMODULE>(library), TEXT(name));
31
return (void*)&GENERATED_GetArkAnyAPI;
35
#elif defined(KOALA_OHOS) || defined(KOALA_LINUX) || defined(KOALA_MACOS)
41
#if defined(KOALA_OHOS)
42
#if defined(__aarch64__)
43
const char libname[] = "/system/lib64/module/libace_compatible_mock.so";
45
const char libname[] = "/system/lib/module/libace_compatible_mock.so";
48
const char libname[] = "./native/libace_compatible_mock.so";
50
void* result = dlopen(libname, RTLD_LAZY | RTLD_LOCAL);
54
LOGE("Cannot load libace: %s", dlerror());
61
extern "C" void* GENERATED_GetArkAnyAPI(int kind, int version);
62
void* FindFunction(void* library, const char* name)
65
return dlsym(library, name);
67
return (void*)&GENERATED_GetArkAnyAPI;
73
#error "Unknown platform"