[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LUA_CPATH_DEFAULT _WIN32 build in luaconf.h Lua 5.1 (beta)
- From: David Burgess <dburgess@...>
- Date: Tue, 8 Nov 2005 23:39:42 +1100
This subject has been done to death in earlier discussions, however:
1) The current CPATH would seem to be a good compromise between many
differing views.
2) What the LoadLibrary documentation does not tell you is how slow it is
when you use a base filename . The current CPATH avoids this slug by
looking in the usual installation place and allowing user overrides with the
current directory (./).
3) It is easy enough to override the default settings if you dont like them by
modifying luaconf.h or setting the LUA_CPATH environment variable or
by modifying package.cpath.
David B
On 11/8/05, JAST <jastejada@yahoo.com> wrote:
> In file luaconf.h In line 59-81 of Lua 5.1 Beta
> WIN32 Build
> ----luaconf.h----
> #if defined(_WIN32)
> /*
> ** In Windows, any exclamation mark ('!') in the
> path is replaced by the
> ** path of the directory of the executable file
> of the current process.
> */
> #define LUA_LDIR "!\\lua\\"
> #define LUA_CDIR "!\\"
> #define LUA_PATH_DEFAULT \
> ".\\?.lua;" LUA_LDIR"?.lua;"
> LUA_LDIR"?\\init.lua;" \
> LUA_CDIR"?.lua;"
> LUA_CDIR"?\\init.lua"
> #define LUA_CPATH_DEFAULT \
> ".\\?.dll;" LUA_CDIR"?.dll;"
> LUA_CDIR"loadall.dll"
>
> #else
> ----luaconf.h----
>
> I notice LUA_CPATH_DEFAULT value is '".\\?.dll;"
> LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"'
> and LUA_CDIR is define as '"!\\"' meaning
> LUA_CDIR is the lua interpreter directory
>
> my interpretation for this is,
>
> if Lua will look for library name "module"
> it will search for the file in the following
> sequence:
>
> 1)".\module.dll" -- in the current directory
> 2)"PathToLuaExecDir\module.dll" -- in the lua
> interpreter directory
> 3)"PathToLuaExecDir\loadall.dll" -- why & what is
> loadall.dll?
>
> I think LUA_CPATH_DEFAULT should be something
> like 'LUA_CDIR "?.dll;" "?.dll"'
> and LUA_CDIR should be "!\\lib"
>
> so if lua will look for library name "module"
> it will search for the file in the following
> sequence:
>
> 1)"PathToLuaExecDir\lib\module.dll" -- in the lua
> c-library directory
> 2)"module.dll" -- Windows Dynamic-Link Library
> Search Order.
>
> in #2 the filename has no path.
> WIN32 API LoadLibrary function which lua use to
> load the library (according to its documentation)
> it will search for the file in the following
> sequence if filename has no path:
>
> 1) The directory from which the application
> loaded "PathToLuaExecDir\module.dll".
> 2) The current directory ".\module.dll".
> 3) The system directories
> 4) The directories that are listed in the %PATH%
> environment variable.
>
> notice that there is no need for ".\\?.dll" and
> "!\\?.dll" to be included in LUA_CPATH_DEFAULT
> because LoadLibrary will search that if filename
> has no path.
>
> see the LoadLibrary documentation:
> http://msdn.microsoft.com/library/en-us/dllproc/base/loadlibrary.asp
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>