Search code examples
symbolsinternalrequirementsdlopen

Does dlopen require a lib to be self-contained?


I call function f1 obtained from dlopen("libxyz.so", RTLD_NOW). I like to know if f1 internally relies on symbols outside of libxyz.so, and the extra libs containing these symbols are "searchable" by the runtime linker, will my application work? Or, is it a requirement that the dlopen'ed lib (libxyz.so in this case) has to be self-contained?


Solution

  • is it a requirement that the dlopen'ed lib (libxyz.so in this case) has to be self-contained?

    There is no such requirement.

    However, if libxyz.so is not self-contained, then it may work in one application (that happens to link in all other libraries required for libxyz.so to work), but fail in another. Therefore it is a good practice to make sure libxyz.so is itself linked against all the other libraries it needs.