dlopen - Undefined symbol error

前端 未结 2 513
一向
一向 2020-12-17 00:24

I\'m using dlopen to load a shared library at run time

dlopen(\"SharedLibarary1.so\", RTLD_NOW | RTLD_GLOBAL);

In that shared object I refe

2条回答
  •  春和景丽
    2020-12-17 01:22

    If possible, you should link each shared library you dlopen() with the linker arguments to force it to resolve all it's symbols when the library is created. This way you can be more sure that you know where all your symbols will be coming from. ("-z defs" for example, under Linux x86)

    That way, if you add a new source file, but forget to add the object to the link, you won't be scratching your head because of a runtime error from dlopen/dlsym.

提交回复
热议问题