-
Notifications
You must be signed in to change notification settings - Fork 105
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
dlmopen support #36
Comments
I feel like it should be fine to expect people to bind this manually if they need the functionality provided by this function. |
While dlmopen is often considered a GNU extension, the concept is not GNU-specific. For one, Windows' DLL APIs are equivalent to dlmopen. In addition to that, dlmopen is also available on SunOS/Solaris. It would be nice if other systems adopted it, as it allows coexistence of, say, Python 2 and Python 3 in the same process space, but in the meantime we should do our best to provide it where available, and panic at runtime otherwise (just a better option than not allowing the library to compile at all, but this is up to you, obviously). If it becomes popular enough, this should be enough to get other systems to support it, as you don't usually want your ports to just panic at runtime. |
I still have found no indication that any other UNIX targets other than the GNU-based ones have this function available. It is not available on macOS for example.
It would be possible to provide it under |
There’re methods to convert to/from raw OS primitives in 0.5.2 so you can |
I've done that in a local project... Any chance to expose some of your |
I wouldn't be opposed to exposing |
+ let name = CString::new(library).expect("invalid library name");
+ let pointer = unsafe { libc::dlmopen(LM_ID_NEWLM, name.as_ptr(), RTLD_LAZY | RTLD_LOCAL) };
+
+ if pointer.is_null() {
+ // I'm ignoring error here
+ }
+
let library = Rc::new(unsafe {
- sys::MyLibrary::new(library)?,
+ sys::MyLibrary::from_library(Library::from(unix::Library::from_raw(pointer)))
}); I followed what you meant. |
I'll make |
No description provided.
The text was updated successfully, but these errors were encountered: