1

Depending on the graphics card in a computer, I want my application to either pick the existing opengl32.dll (located in C:\Windows\System32), or a Mesa\software fallback opengl32.dll. Is it possible to do this at load time, or is this out of my control?

If not, is it possible to execute my own code at all before .dll files are loaded in a windows application (my backup solutions is to simply rename the software .dll file contained in the same dirextory as my executable) ?

2 Answers 2

2

Yes. Use delay loading. This is a very simple compiler flag. Behind the scenes, it will generate the LoadLibrary and GetProcAddress calls for you.

Sinde the actual loading of opengl32.dll will now be delayed to the first call of an OpenGL funciton, you have time to call SetDllDirectory.

Sign up to request clarification or add additional context in comments.

Comments

2

Check out LoadLibrary(Ex).

1 Comment

Worked in my real project, but not in my prototype project. Good enough.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.