安卓dlopen dlsym dlclose
动态加载so库
1. dlopen("绝对路径/lib.so”) 函数原型:
void* dlopen(const char* __filename, int __flag);
2. dlsym 函数原型 void* dlsym(void* __handle, const char* __symbol); 这个返回值需要 reinterpret_cast<int*> 强制类型转换 获取值需要解引用
3. dlcose int dlclose(void* __handle);
1 void* handle = dlopen(full_path,RTLD_LAZY); 2 int* b = reinterpret_cast<int*>(dlsym(handle, "b")); 3 dlclose(handle);
浙公网安备 33010602011771号