Re: Opt out style recommends
* Ben Hutchings <ben@decadent.org.uk>, 2016-04-11, 02:22:
Would it be useful to have a linker option to omit a NEEDED entry for a
particular library? The application could then call
dlopen("libfoo.so.42", RTLD_NOW|RTLD_GLOBAL) before it starts using the
library, typically right before calling foo_init(), but it wouldn't
need to use dlsym(). However this would absolutely depend on lazy
binding, i.e. the application would break if LD_BIND_NOW was set.
It's kinda possible already: just remove -lfoo from the linker command
line (and add -Wl,--unresolved-symbols=ignore-all if you're building an
executable). The downside is that the unresolved symbols will be
unversioned, and that you have to hardcode soname in the code... which
means it'll all explode sooner or later.
--
Jakub Wilk
Reply to: