lua-users home
lua-l archive

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


  So you are saying that one possible solution is to call SetDllDirectory on the Lua interpreter?

  Checking its documentation it looks promising. The only drawback is that it needs Service Pack 1 in Windows XP.

Best,
scuri

> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-
> bounces@bazar2.conectiva.com.br] On Behalf Of Cosmin Apreutesei
> Sent: terça-feira, 12 de janeiro de 2010 12:38
> To: Lua list
> Subject: Re: LoadLibrary and 5.2
> 
> >  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()
>   kernel32.SetDllDirectoryA:types{ABI='stdcall',ret='int','string'}
> end,debug.traceback)
> 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)
> end
> 
> function set_dll_directory(dir)
>   assert(kernel32.SetDllDirectoryA(dir) ~= 0, 'SetDllDirectoryA()
> error')
> end