I am getting an undesired loading of a shared library which has already been loaded.
I have a binary(test_bin) which is supposed to load a shared library(libtest.so). Also, I have a C python extension module(extension.so) which also loads libtest.so
Now, when I start the binary with an embedded python interpreter and import the extension module, I get a lot of errors happening due to the static globals in the library getting initialized twice.
My question is, in this case why is libtest.so loaded during the extension import even though it has already been loaded by the binary(have confirmed this with lsof)
Note: The version, name and location of the shared library used by the binary and the python extension are all same(verified by ldd)
Invocation:
./test_bin
In [1]: from some.location import extension
# errors due to double initialization
Please let me know if you need any other information