Search code examples
gccclang

Will a program run if a .so file is not found but no function is called


The question is for example I have my.binary that depends on 1.so that depends on 2.so that depends on 3.so. When doing 'ldd 1.so', it only shows that it depends on '2.so', so will my.binary execute if '3.so' is missing but not a function is called from '3.so'? Basically '3.so' is shipped with my.binary, but during some runtime checks, it is not used under certain condition.

I do see sharedlibrary not found error if 2.so does not exist..


Solution

  • No, this functionality is called lazy loading and is not supported by Linux shared libraries. You can work around this by manually loading library via dlopen/dlsym instead of directly linking to it.