Can I export some particular C bindings for GPU drivers to see?


I’m trying to use ModernGL.jl to make a graphics program. However, my NVidia driver keeps using my integrated graphics instead of my discrete card. I can manually fix this in my driver settings, but I don’t want to have to manually do that on every machine which might run this program (plus that setting isn’t working for me).

Both NVidia and AMD offer a way to tell the driver that your program should default to discrete GPU instead of integrated GPU. You must export a specific constant in your executable:

    _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
    _declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;

Can I use Clang.jl or CBinding.jl to do this? I am not very experienced in the interactions between Julia and its underlying compiler.