lua-users home
lua-l archive

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


Hi,

cloudwu wrote:
> LoadLibrary will load dll in system directory before current
> directory by default settings.

Quoting MSDN (emphasis mine):
  "If the string DOES NOT SPECIFY A PATH, the function uses a
  standard search strategy to find the file."

But Lua always specifies a path (i.e. a string containing a
backslash) when using require.

> For example, I create a C module named console.dll and put it in
> my current directory.

You need to put it into the directory where lua.exe is stored.
This may or may not be the current directory. See the search path
order at the beginning of luaconf.h or 'print(package.cpath)'.

> require "console" In lua, it failed.
> lua load the console.dll in windows\system32 instead of my
> .\console.dll .

This is strange and shouldn't happen according to the MSDN docs.
Well, unless you've stored lua.exe in windows\system32 ... (don't!)

Can anybody else reproduce this? Which of the package.cpath
components causes this? IMHO ".\\?.dll" should not trigger the
standard search strategy according to the docs.

Bye,
     Mike