lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Aug 28, 2008 at 12:13 PM, Antonio Scuri <scuri@tecgraf.puc-rio.br> wrote:
 Here is an example of LoadLibrary effects:

 I changed the default LUA_CPATH to:

#define LUA_CPATH_DEFAULT \
       ".\\?.dll;"  ".\\?51.dll;"  LUA_CDIR"?.dll;" LUA_CDIR"?51.dll;"
LUA_CDIR"clibs\\?.dll;" LUA_CDIR"clibs\\?51.dll;" LUA_CDIR"loadall.dll;"
LUA_CDIR"clibs\\loadall.dll"

 I tested using IUP. The Lua binding is "iuplua51.dll" that depends on
"iup.dll". The test code does require"iuplua".

 Then if I move the dlls to the "clibs" folder then it fails to load the
module. Because "iup.dll" is not found by the system when it tries to load
"iuplua51.dll", even if they are in the same folder. This happens because
the standard search path includes only the executable folder, nor the folder
of loaded DLLs.

 When using LoadLibraryEx with the flag LOAD_WITH_ALTERED_SEARCH_PATH, then
it successfully loads "iuplua51.dll" and with no change to the PATH
environment.

 I intend to release LuaBinaries for Lua 5.1.4 with the above LUA_CPATH.
But with no changes to the loadlib behavior.

Lua for Windows will not be setting the LUA_PATH or LUA_CPATH any more. It will use the defaults. But, because of the way Windows loads dlls Lua for Windows will continue to add two PATH variables; one for the lua.exe directory and one for the 'clibs' directory so that modules will load correctly.

If and when the official Lua changes to using LoadLibraryEx with the flag LOAD_WITH_ALTERED_SEARCH_PATH Lua for Windows will remove the 'clibs' directory from the PATH environment variable.

Thoughs?
--
Regards,
Ryan
RJP Computing