lua-users home
lua-l archive

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

>  I understand what you are saying but the main motivation for the change
> was NOT to find modules, it was to find DLLs that the modules depend on and
> that are not Lua modules.
>  For example, iuplua depends on iup. When iuplua is required the iup DLL
> must also be found. And this is NOT handled by the package.cpath. Lua for
> Windows has lots of these DLLs that are NOT modules. That's the only reason
> the Lua for Windows installation must change the PATH so these DLLs can be
> found in the "clibs" subfolder.
>  Is there any other solution to this problem despite changing LoadLibrary?

As usual M$ solve it very late in the game... Here's a snippet from my
win32 test suite of fbclient:

--bind SetDllDirectory from kernel32.dll (available in WinXP SP1+ and Vista)
--it's the official way in Windows to load a bunch of related dlls
from a directory of your chosing.
local alien = require'alien'
local kernel32 = alien.load('kernel32')
local ok,err = xpcall(function()
if not ok then
  error ([[
Sorry but you need a kernel32.dll with SetDllDirectoryA() (WinXP SP1+ or Vista)
to run the automated test suite on Windows.
The error was: ]]..err)

function set_dll_directory(dir)
  assert(kernel32.SetDllDirectoryA(dir) ~= 0, 'SetDllDirectoryA() error')