-
Notifications
You must be signed in to change notification settings - Fork 102
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
support opening existing library #27
Comments
Is using OS-specific open with appropriate flags not good enough? Windows is more tricky. I did not implement That being said, I would gladly take a PR that adds an |
I'm trying to add support for optional functions in rust jack (audio connection kit) bindings. and since jack is available for windows a cross platform solution is preferred.. My plan was to add an "open" method that does as far as i can see, semantics are similar: both functions will return a handle that lets us find symbols, and increase the library ref-count - can you elaborate on the difficulties you mention? |
I do not exactly remember the exact difference. Besides it is fairly trivial to implement opening exactly the way you want it in library:
This seems fairly concise to me and does not run into the problem where the flag combination to the underlying call to OS is not quite what they need for their exact use case. All we really need is the implementation of |
I think it maybe confusing to implement open for windows. For unix, open always calls for dlopen. but in windows, if we want to load a new library, we have to call LoadLibrary. and if we want to open an existing one we call GetModuleHandleEx. I have 2 thoughts on how to address this:
Thoughts? |
|
I think this should be fixed by 8a0138d? |
So I happened to need this in my project and I think there's a misunderstanding here? What I currently need (and what I believe the issue is about) is a method
This can be accomplished with 8a0138d adds a method to get the handle to the calling library itself, which is not really related. |
Yeah, sorry, my bad.
|
As I said before, though, I'm happy to accept at least a PR for the Windows side of this! |
Hello,
Currently you can do
Library::new()
which loads a library.For my use case it would be create to have
Library::open
that opens an already existing library.Implementation can be accomplished with the RTLD_NOLOAD flag for dlopen on most unixes and GetModuleHandleEx in windows.
I can write the code myself and submit a PR if that works for you.
The text was updated successfully, but these errors were encountered: