[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: package proposal
- From: David Burgess <dburgess@...>
- Date: Sat, 18 Sep 2004 10:42:43 +1000
Thanks Roberto.
question:
Q 1) If I have mylib.lua and mylib.dll, then "require'mylib'" will
load the DLL first. (I like this). What was the thinking behing this?
Q 2) If CPATH is empty then the mylib.lua would be loaded rather than mylib.dll.
Methinks that for Win32 (at least) that an empty or non-existent CPATH
should result in loadlib("mylib", ...). This will by default search
the executable
directory, the current directory, system directories and then whatever is in
the PATH environment variable.
So
>package.cpath = os.getenv("LUA_CPATH") or
> "./?.so;" ..
> "/usr/local/lib/lua/5.0/?.so;" ..
> "/usr/local/lib/lua/5.0/lib?.so"
> "/usr/local/lib/lua/5.0/?.so;" ..
> "/usr/local/lib/lua/5.0/lib?.so"
is sort of redundant because the first place loadlib looks is where lua.exe
exists.
> "./?.so;" ..
is sort of redundant because cwd is the second place loadlib looks.
In general loading from cwd is
hence I think this should become
package.cpath = os.getenv("LUA_CPATH") or ""
and
the load sequence should be
1. if LUA_CPATH exists or is non blank use your specified search strategy.
2. loadlib("module")
Did I miss something here?
Q 3) Luiz's library name convention of namespace = 'mylib' and
the file name of 'lmylib.so' and the open function of
'luaopen_mylib' is changed to use 'mylib.so'.
Again what was the reason for this change?
Also for Win32 methinks it would be better to try loadlib() rather than do the
fairly slow "fopen()" existence check.
DB