lua-users home
lua-l archive

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


> Just to be sure. I am presuming this is added to the current order
> of preload, C loader, Lua Loader.

Yes (except that we changed that order, remember?).


> Does this mean that require"a.b" will also try module "a" in the C path;
> if found, tries to find the function luaopen_a_b?

Yes.


> This means I could package a socket.dll with entry points of
> luaopen_socket luaopen_socket_http luaopen_socket_smtp etc Yes?

Yes.


> If we were to assume that it is fair that the LoadLibrary need only be
> tried once when it is unsuccessful, [...]

LoadLibrary is unsuccessfuly tried only when there is no "a.b" module,
there is a "a" module, and it does not define "luaopen_a_b". This is
rare, and probably means an error (module actually not found). So it
will happen only once (the program would stop after that error).


> > - add yet another loader after the others:
> No.
> If this is the 5th loader, no. LoadLibrary() on Windows with a
> LUA_CPATH of  "?.dll" would potentially search the the Windows path
> each time (plus the Windows search strategy), this takes a looong
> time. Adding this loader would be the third unsuccessful LoadLibrary()
> call. This would take seconds.

No. An unsuccessful call to LoadLibrary in the C loader is a hard
error (it stops the search). An unsuccessful call to LoadLibrary
in the fourth loader probably means an error too (see previous answer).
And this last call only happens if there is a "generic" dll file defined.
(We never use LoadLibrary for searching; we only call it after
finding a file.)

-- Roberto