相关疑难解决方法(0)

使用dlopen加载库时收到"未定义的符号"错误

我正在编写一些使用动态共享库作为插件的代码.

我用于构建共享库的命令行如下所示:

cc -shared -fPIC -o module.so -g -Wall module.c
Run Code Online (Sandbox Code Playgroud)

在模块中,我可以调用已在主可执行文件中加载的任何其他共享库中的函数.

但是,我无法访问可执行文件本身的(导出的)函数(我收到undefined symbol错误).

我的电话dlopen看起来像这样:

void *handle = dlopen(plugin, RTLD_NOW);
Run Code Online (Sandbox Code Playgroud)

谁能告诉我的模块如何回调我的可执行文件,而不必将所有可执行文件的实用程序功能放入另一个共享库中?

shared-libraries dlopen

20
推荐指数
2
解决办法
2万
查看次数

标签 统计

dlopen ×1

shared-libraries ×1