-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add optional RTLD flags argument to dlopen, fixes issue #2312 #2380
Conversation
I like this one. Will wait for @JeffBezanson to take a look though. |
I really like this too. |
(Note, by the way, that |
@JeffBezanson, is this okay to merge, since explicit RTLD flags seemed to be your preference in #2317 as well? |
add optional RTLD flags argument to dlopen, fixes issue #2312
This is fine, since if you're going to call |
@JeffBezanson What's your opinion on the add_library_mapping trick I'm using in Cairo/Tk. Too hacky or something worth exposing? |
@JeffBezanson, regarding static compilation, I don't see this as such a big problem:
(I have to use |
It is of course a good point that statically-compiled programs can use The All this does seem to ask for a better solution though. We should probably build in the pattern of dlopening at run time and caching the result of dlsym for each call site. Basically some way to specify whether a particular library should be bound at compile time or startup time. |
As a more general alternative to my #2317 patch (to fix #2312), this patch makes all
dlopen
flags available in Julia: it adds an optional argumentwhere the second argument is a bitwise-or of RTLD flags, which defaults to
RTLD_LAZY|RTLD_DEEPBIND|RTLD_LOCAL
.So, a library can be opened for global access via
dlopen(libfile, RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL)
.Note that if a flag is not supported on the running platform (e.g. Windows), it is simply ignored.