I’ve got a problem on my laptop that didn’t used to exist, and I’m not sure how I developed it, but basically I can’t load the opengl32.dll (or for that matter, the glu32.dll, or ddraw.dll). Other dlls I’ve randomly picked out of the c:\winnt\system32 folder load fine. I’ve uninstalled/reinstalled the latest video card drivers (ATI Rage Mobility P on a Dell Inspiron 7500, running Windows 2000), and even went so far as to reinstall the OS (although I didn’t start fresh, I installed over the previous version).
Has anyone seen something like this before? Does anyone have hints or suggestions on where I could find the answer - I’ve searched all the newsgroups and I’m at a complete loss.
This is not GL related but I’ll answer.
from inside your exe
It should work since the OS will search for the DLL automatically.
If it doesn’t, then use GetLastError as usual.
I dont know what happens if you are not the administrator.
I did try GetLastError (sorry I forgot to mention). It was rather useless; the error code was 1114, which said DLL NOT LOADED. No kidding.
I understand it’s not opengl related, but I’ve been totally flustered, so if you could help I’d greatly appreciate it. Thanks!
Try running depends.exe (comes with Visual C++), then open opengl32.dll and it will show you all the DLL’s required by opengl32.dll. It will also show you if a required DLL is missing or if one of the required DLL’s is missing a function (i.e. its an older out of date version).
Wow, Depends.exe is a great program! Thanks for pointing it out. (I actually am developing with Borland Delphi, so I hadn’t heard of Depends.) Well, I update here for those interested.
It seems that my problem is with ddraw.dll not opengl32.dll or glu32.dll exactly. On my laptop, the opengl32.dll is dependent on ddraw.dll, which fails in its DllMain called with DLL_PROCESS_ATTACH. Why it returns failed is unclear to me, since all its imports and exports seem error free. But I guess I’ll have to mess with my DirectX installation.
Thanks for the perfect lead!
I’d suggest installing WinDbg and start looking at kernel debug output data. WinDbg is available as free download from ddk.microsoft.com – you want the latest available beta version, usually.
Make sure you never call LoadLibrary in a DllMain function: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp
In case you use WinNT 4.0 there’s a known bug with ddraw.dll not loading if virtual address space at 0x43000000 is occupied: http://support.microsoft.com/default.aspx?scid=kb;en-us;257655
And search the knowledgebase for other known ddraw.dll problems.
Final update. Since I was running DirectX 8, I installed DirectX 9, and the problem was fixed. Thanks for all the helpful advice!