我正在尝试为我的 android 设备创建 ac 程序。它使用 dlopen 和 dlsym 在共享库中打开一个函数。我用 arm-none-linux-gnueabi 编译。我的 helo.c 程序如下所示:
helo.c
#include "stdio.h"
#include "dlfcn.h"
void main(int argc, char ** argv) {
void *handle=0;void *func=0;
handle = dlopen("sharedlib.so", 1);
if (handle == 0) {
printf("Failed openning lib\n");
return;
}
func = dlsym(handle, "hello_world_");
if (func == 0) {
printf("Failed func\n");
return;
}
dlclose(handle);
}
我正在以这种方式编译:
arm-none-linux-gnueabi-gcc -w -g3 -O0 -ggdb hello.c -o hello -ldl -Wl,--dynamic-linker=/system/bin/linker
但是当我尝试在我的设备上运行时,我收到了这个错误
link_image[1936]: 1983 could not load needed library 'libdl.so.2' for helo (reloc_library[1285]: 1983 cannot locate '__cxa_finalize'...)CANNOT LINK EXECUTABLE
任何想法