Is there an alternative to the RTLD_DEEPBIND flag in the dlopen () function for platforms that do not support RTLD_DEEPBIND?

I have a problem with a third-party library (say TP.so) using the wrong version of the library (say GenericV1.so), instead of using the one it should (say GenericV2.so). An extra library is included for my program.

A direct solution to this (well-documented in SO) is to use dlopen () with the RTLD_DEEPBIND flag. But the flag is valid only for Linux, and not for other platforms such as HP-UX, Solaris, AIX, etc.

Is there an alternative for RTLD_DEEPBIND for use on these platforms other than Linux?

Thanks for your feedback.

+7
source share
1 answer

It seems to me that you don't need RTLD_DEEPBIND at all. You only need to make sure that libraries with competing characters are loaded in the correct order.

Some ideas:

  • You can use LD_PRELOAD to make sure that the correct library (GenericV2.so) is loaded before any other libraries.

  • You can create a function that expands the libraries in the correct order: GenericV2.so and then TP.so.

  • Can I make sure that GenericV1.so is never loading? Do you need anything from this library?

0
source

All Articles