Hi! On Mon, 2017-11-13 at 13:23:01 +0100, Ferenc Wágner wrote: > I'm packaging a program which wants to dlopen() some library. It finds > this library via pkg-config (PKG_CHECK_MODULES). How to best determine > the filename to use in the dlopen() call? It should work cross-distro, > for cross-compilation and whatnot. Is it always safe to use the SONAME > as the filename? I'm currently considering something like > > ld -shared -o dummy.so $(my_LIBS) > objdump -p dummy.so | fgrep NEEDED > > coded up properly for Automake. I'd be grateful for any insight.
IMO dlopen()ing an external library that is not part of the same project is a practice that should be very strongly discouraged, if not completely abolished. Please see this very nice mail from Simon McVittie [S], my reply [G], and Florian Weimer's [F], for several of the reasons why. [S] https://lists.debian.org/debian-devel/2017/03/msg00164.html [G] https://lists.debian.org/debian-devel/2017/03/msg00343.html [F] https://lists.debian.org/debian-devel/2017/03/msg00346.html Thanks, Guillem