lua-users home
lua-l archive

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


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