You can load a library twice, in theory, if it's compiled as position-independent code (-fPIC
).
On some Unices, you can then dlopen
the library twice if your loader has an RTLD_PRIVATE
flag, or by having two "different" copies of the library with the same symbols (put it at two different paths, otherwise it will just return the first file handle), and opening them each with RTLD_LOCAL
.
I don't know anything about Windows shared libraries. It may not even be possible.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…