I am writing a library that is loaded dynamically by another progam. This library uses some Boost libraries (for example, thread). Is it possible to make it work somehow without recompiling the program in question?
If I use the link flags -lboost_thread
, it doesn't work, because the program that uses this library would need to link the same Boost library, too. Using /usr/lib/libboost_thread.a
also doesn't work, because the .a
file isn't compiled with -fPIC
.
I am using GCC under Linux.
Trying again, I found that the problem was not what I described. The library didn't load for some other reason. I found that linking the library with -lboost_thread
works, with the following conditions:
-L
path which is not in $LD_LIBRARY_PATH
).