1

Due to the (not relevant for this question) restrictions of OpenGL implementation in Virtualbox (only OpenGL version 1.1 available, but I need at least version 2.0) I decided to use software implementation in form of a DLL (named opengl32.dll) which can be downloaded from here: ftp://ftp.blender.org/sergey/softwaregl/

One way to do it is to put the file opengl32.dll directly into the same directory as the executable file.

My question is: what is the best way to make this software implementation available to all the programs without copying the DLL files around.

Important notice: All the 32 bits applications need the file opengl32.dll from the directory /win32/ of this FTP server, while all the 64 bits applications need the file opengl32.dll (same name, but it's a different file!) from the directory /win64/. Thus if I have one 32 bit and one 64 bit application in a same directory on my computer, the solution of putting the DLL into the same folder doesn't work: it's not possible to have two different files with the same name in a same directory.

ilya
  • 145

3 Answers3

2

You need to put your 64bit dll to c:\Windows\System32 and your 32 bit dll to c:\Windows\SysWOW64.

Note, that on Windows 10 original OpenGL32.dll files are only accessible by TrustedInstaller user. So, to replace them you have to change ownership of those files to Administrator. For me it was not possible to do that using any UI, but command line approach worked. To do that, run the Command Prompt as administrator. Then use the following commands to delete the original OpenGL32.dll files:

takeown /F C:\Windows\System32\OpenGL32.dll /A icacls C:\Windows\System32\OpenGL32.dll /T /grant administrators:F move C:\Windows\System32\OpenGL32.dll C:\Windows\System32\OpenGL32.dll.orig

Same for C:\Windows\SysWOW64 directory.

After that, just copy your own OpenGL32.dll to those locations as administrator.

Edit: Software Opengl32.dll implementation can be downloaded also from https://fdossena.com/?p=mesa/index.frag

igagis
  • 136
1

The usual solution is to have two sub-folders like that :

Installation folder
    |--- Win32 DLL
    |--- Win64 DLL

The program's .exe is placed in the main folder, but is not directly called. Instead it is started via a .bat file that checks whether Windows is 32- or 64-bits and starts the .exe in the context of the matching sub-folder. A DLL is searched in several folders, one of which is the current folder.

See the post batch file to check 64bit or 32bit OS.

If you are worried about the .bat file appearing as a black square window, you may start it as hidden as described in the post Run a batch file in a completely hidden way. A GUI program that is started from such a hidden batch file will not itself be hidden.

harrymc
  • 498,455
0

Using the KnownDLL mechanism might help. Known DLL's bypass the filesystem search and instead are loaded from a single fixed directory. Conveniently, there's one KnownDLL directory for 64 bit processes and one KnownDLL32 directory for 32 bit processes.

MSalters
  • 8,283