The DLL's in the Windows system directories have the potential to interfere, and on Windows 7 there are close to 1500 of them. where the EXE is located), then various Windows system directories, then the current directory, and finally the directories in the PATH environment variable. In the "Standard Search Order for Desktop Applications" with "Safe Dll Search Mode enabled", which is normally the default behavior, Windows will search in the "The directory from which the application loaded" (i.e.If a match is still not found, a search order (standard or alternate) is done as described below. If a system DLL " kernel32.dll" is loaded and you later try to load your own " kernel32.dll" using an absolute path, both will indeed load.
This rule seems to only govern DLLs that are not loaded with an absolute path. The system does not search for the DLL." In Windows 7, there are a few dozen of these known DLLs, including user32, kernel32, gdi32, msvcrt, and others.
Also, if you use or manifests (see manifest/WinSxS links at bottom), those techniques are used to find the DLL before the other techniques below. (Also, Windows Embedded (CE) /Mobile have special rules described later below.) In particular.įirst, "If the string specifies a fully qualified path, the function searches only that path for the module.". These rules are complicated and tend to change between versions of Windows. See for the rules governing the order of search paths that Windows looks for the DLL in. In Lua 5.2-beta, loadlib.c calls LoadLibraryExA, and its third parameter is taken from the LUA_LLE_FLAGS define (which defaults to 0). In Lua 5.1, loadlib.c calls LoadLibraryA.
These functions have Unicode ( LoadLibraryW/LoadLibraryEx) and ANSI ( LoadLibraryA/LoadLibraryExA) variants for the file name parameter. Windows almost always loads DLLs via the or Win32 API functions. On Windows, binary modules are dynamically loaded into Lua as. Lua-users wiki: Load Library Load Library