We help IT Professionals succeed at work.
Get Started

In C++ application, Wait until runtime to choose the path to the openGL32.dll that is called.

cjm 32
cjm 32 asked
on
33 Views
Last Modified: 2020-07-25
In C++ application, I want to wait until runtime to choose the path to the openGL32.dll that is called. There are two possible paths: path #1 is the path to the directory in which the application resides (which is in the Program Files (x86) directory; path #2 is the system folder. Just having the openGL32.dll present in the application's directory results in it being called. I'd like to have the option of continuing to leave the openGL32.dll in the application directory, but just NOT call it but instead use the openGL32.dll in the System directory.

I've tried a couple approaches and neither of them work thus far. So, here is some additional info:

In the project settings, I am linking against opengl32.lib,, glu32.lib, and glaux.lib. Also in the project settings, I have listed openGL32.dll under the "Delay Loaded Dlls" field.  In my application's InitInstance(), I have tried calling SetDllDirectory("C:\\Windows\\System32\\openGL32.dll"); however, even though this function returns TRUE, the openGL32.dll that resides in the application's directory STILL GETS LOADED AND USED.

I've also tried calling LoadLibrary("C:\\Windows\\System32\\openGL32.dll") from IniitInstance(), thinking this would "force" the system version to be used; however, even though this function returns a valid handle to the dll, the openGL32.dll that resides in the application's directory STILL GETS LOADED AND USED.

I've also tried a quick and dirty approach of moving the openGL32.dll out of the application's directory, which would then "force" the openGL32.dll in the System folder to be used; however, due to permissions issues with out users (not being given permission to delete/move files from the application directory, this is not the preferred approach.

Any help would be greatly appreciated!!!
Comment
Watch Question
This question hasn't been answered yet.
While you wait, find out how you can maximize your capability with the most trusted tool in IT.
Explore More Ask a Question
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE