lua-users home
lua-l archive

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


Mike Pall wrote:

> Doesn't ".\\?.dll" work? This would be analogous to the way
> the POSIX variant avoids a (useless and dangerous) path search
> ("./?.so").

Yes it works, but what is the current directory in windows?
cwd is a different concept to Unix, it depends on :
the OS (version)
how you have invoked it (console, desktop, shortcut, explorer,
service,  etc etc)
Also what I read was not ".\\?.dll" but "?.dll". 
I probably did not explain it well. If the name passed LoadLibrary is a filename
rather than a path then the windows 6 part search strategy is used. 
"?.dll" is maybe alright at the end of the CPATH because it means search
just about everywhere.

The documentation says that the first step of the search strategy is
to load from
the application directory (where lua.exe exists), so functionally it
is the same as
!\\?.dll (if the dll exists). It just takes longer.

I take your point about how to override the installed dll. However, I
was thinking
that adding the current directory allows a degree of freedom for user error. The
app may end up loading a dll you did not expect. 
LUA_CPATH or package.cpath can be updated when you wish to override a dll.
I was only thinking about the *default* case. 
Your summary of changes is probably a fair compromise.

> Yes. And while I'm at it ... why are Lua modules searched in the
> Lua path _and_ the C module path? This is a regression from 51w6.
Agreed.

> Especially since Lua modules are searched first.
My vote was for maintaining the C first order (I apologize for the
recalcitrance).

regards
David B