I have application that has a function f1 void f1 ()
In addition, I have a library that I load using LD_PRELOAD
.
The library has several code files and several header file, and it compiled to .so file.
On of the header files also uses a function named f1
with same signature as above.
The latest f1
is used only in the library. (I can not change it to static method)
The problem is that when I load the library (using LD_PRELOAD
) f1
from the library overrides f1
of the application.
Is there a way to configure f1
of the library to be visible only to the library?
If you can modify the header files at all, make the function static
to make it visible only in that compilation unit, or mark it with __attribute__ ((visibility ("hidden")))
(GCC only) to make it visible only in that library:
__attribute__ ((visibility ("hidden"))) void f1();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With