Finding DLL files (Interpreter vs .EXE)
- Posted by marky1124 <mark_young at hotmail??om> Apr 18, 2008
- 546 views
Hi, I have discovered that the way in which .dlls are found and loaded changes if I am running my code through the Euphoria interpreter or bound as an EXE. My code does open_dll("libcurl.dll"). libcurl.dll depends on libeay32.dll and libssl32.dll. All three .dlls are in the current directory from which I run these test. There is an older version of libeay32.dll in c:\windows\system32 (I'm using XP). I am using sysinternals filemon to monitor attempts to access the lib*.dll files. If I run the code as "exw test.exw" then I can see EXW.EXE look for libcurl.dll in the following locations in this order: C:\EUPHORIA\BIN\libcurl.dll - NOT FOUND C:\WINDOWS\system32\libcurl.dll - NOT FOUND C:\WINDOWS\system\libcurl.dll - NOT FOUND C:\WINDOWS\libcurl.dll - NOT FOUND C:\my_development_directory\libcurl.dll - FOUND When it reads in libcurl.dll it moves on to locate the dlls that libcurl.dll requires, here's where it looks C:\EUPHORIA\BIN\libeay32.dll - NOT FOUND C:\WINDOWS\system32\libeay32.dll - FOUND It then fails because it's found an old libeay32.dll which is incompatible, it hasn't looked in my development directory where the correct version is waiting to be used. If I now bindw test.exw into test.exe and run then the behaviour is different. It looks in the current directory first for the .dlls and given that it finds them it looks no further. If the .dll is not in the current directory then it goes on to look further in this order: C:\my_development_directory\libcurl.dll - NOT FOUND C:\WINDOWS\system32\libcurl.dll - NOT FOUND C:\WINDOWS\system\libcurl.dll - NOT FOUND C:\WINDOWS\libcurl.dll - NOT FOUND I am completely new to Windows development and DLL handling. Finding out the above caused me a fair amount of confusion, so I thought I'd share my experience here and also put it out for comment - Is the Euphoria interpreter doing the right thing in the way it handles DLL searches compared to the bound version of the same code? At the very least it confused me as a new developer, especially since the error I encountered said "Can't find libcurl.dll" when in fact the real issue was an incompatible libeay32.dll in c:\windows\system32. Thanks very much for your attention, Cheers, Mark