-
Notifications
You must be signed in to change notification settings - Fork 6
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
Load Using GetModuleHandle on win32 and RTLD_NOLOAD on Unix #128
Comments
So I looked, and as of 0.7.3, For future peeps: Instead of using the cross platform |
Yeah we should file an issue there, but in the mean time the things in libloading are just constants of type c_int, so we can add whatever flag we want there by just finding the right number. |
Found it? Apparently it's 0x4, so either hardcode that, or add a dep on libc as we wait for libloading to get this constant (which is a bit much for such a small change). |
Please test my fork at https://github.com/Jengamon/renderdoc-rs, as I think this should properly load the library, but I can't test it rn as I'm currently on a Mac. |
I can likely test sometime this week, I'm also currently on a Mac lol |
Is there any instructions how to test this? |
I'm very sorry for the long-time radio silence on this! Thanks for reporting this issue. Somehow, I missed this when reading through the documentation initially. I'm glad you've managed to work around this upstream in |
Related issue gfx-rs/wgpu#2793
Renderdoc is very particular about how it is loaded - particularly it cannot be loaded if there is no renderdoc client running in the process. This hasn't been a problem for the most part as librenderdoc is not available in the dynamic library search path on most systems, but gfx-rs/wgpu#2789 is an example where it is. I asked baldurk about this and he pointed out we must use the RTLD_NOLOAD flag to dlopen on unix and GetModuleHandle on windows.
See the documentation here for more info: https://renderdoc.org/docs/in_application_api.html
The important bit:
In libloading terms:
On windows this should call https://docs.rs/libloading/latest/libloading/os/windows/struct.Library.html#method.open_already_loaded which is GetModuleHandle.
On linux this should call https://docs.rs/libloading/latest/libloading/os/unix/struct.Library.html#method.open with
RTLD_NOW | RTLD_NOLOAD
- the latter needs to be added to lib loading, but it's just an integer so we can just specify the value until lib loading adds it.The text was updated successfully, but these errors were encountered: