-
Notifications
You must be signed in to change notification settings - Fork 480
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
[Question] How to dllexport NvOptimusEnablement symbol to auto select dedicated Nvidia GPU? #582
Comments
I think this is more related to rust itself than rust-sdl2, and unfortunately I don't know anything about your issue. This might be useful for other rust-sdl2 users as well, so if you find a clue or a solution we could add this for both AMD and Nvidia GPUs, so please follow notify us if you do find something |
Did you figure something out ? |
I put the question in rust user forums here There are views but no replies... I tried this in main.rs
which gives error ->
but then got hit with this issue -> I investigated ways to modify linking via cargo.toml via .cargo/config file this works up to the linker but now, and I get this error:
I guess the value (not function) export in main.rs did not work its way up to the build_script_build.lib
Note: I am using visual studio tool "dumpbin" to check exports in the .exe and not seeing. This issue seems to be related So we can totally replace the linker with our script Overall impression is that, according to some comments I read in issues related to this, the linker area in rust (and its integration with cargo) is yet to stabilize, and may still change in future. So a custom linker attachment may now be the only way forward. On a related but different subject: |
This is rust related question with specifics for gpu usage in rust-sdl2.
In normal C/C++ SDL2 app I wrote, adding the following code
extern "C" {
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
}
causes the driver system with integrated and dedicated nvidia gpu, to auto select the dedicated nvidia gpu.
See here for some explanation of the mechanism->
urho3d/urho3d#139
http://stackoverflow.com/questions/16823372/forcing-machine-to-use-dedicated-graphics-card
I searched around rust documentation but things i found were about dllexport of pub methods of libs, not applications, and not just symbol values. I got confused about the best way to export this symbol from a rust-sdl2 app (using crate)
How can I make my rust sdl app (not a library) dllexport this symbol with this value ?
The text was updated successfully, but these errors were encountered: