This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
dlopen with RTLD_PRIVATE?
- From: Tom van Dijk <tom at tvandijk dot nl>
- To: libc-help at sourceware dot org
- Date: Wed, 27 May 2015 12:07:05 +0200
- Subject: dlopen with RTLD_PRIVATE?
- Authentication-results: sourceware.org; auth=none
Hello,
Judging from a cursory search on the internet, quite a few people
would love to have dlopen with an RTLD_PRIVATE flag, which would allow
opening a .so file that has some internal state multiple times.
for example:
http://stackoverflow.com/questions/24365989/loading-two-instances-of-a-shared-library-without-rtld-private-or-multiple-copie
http://stackoverflow.com/questions/3433522/loading-two-instances-of-a-shared-library
This appears to be implemented eg in UnixWare:
http://uw714doc.sco.com/en/man/html.3C/dlopen.3C.html
Our my case, I'd like to load a .so that is not thread-safe for every
thread. Using only one instance protected with a mutex is not an
option, as I'm interested in a highly parallel application.
Is this something that is difficult to implement in glibc for some
reason? Or is there already some solid alternative for this problem? A
search did not find satisfactory solutions, although there is a
workaround by copying the library to uniquely named files in /tmp on
runtime and loading each copied file separately, but I'd say you'd
agree that this is a pretty dirty solution.
Cheers,
Tom.