[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Update #4 to Lua 5.1-work3 loadlib cleanups
- From: David Burgess <dburgess@...>
- Date: Fri, 24 Dec 2004 09:53:19 +1000
> We already put the handle in the registry, to avoid its collection.
> Currently the handle is the key, but it could be the value, with
> filename being the key (with an appropriate prefix to avoid name clashes
> in the registry).
>
In Lua 5.0 I patched loadliv to use the lowercased last component of the
library path(the filename) as the key. This suited *my* needs. Methinks
it is not unreasonable to enforce uniqueness of the filename or the
entry point name. I believe that MAC entry point names must be
unique in any case.
>
> > put luaopen_socket and luaopen_sockethttp in the same DLL. Is this so,
>
> Currently there is no "obvious" way. One solution is to have a main
> entry point, which must be required first, that uses PRELOAD to register
> the other entry points. Another solution is to have little Lua stubs
> that use loadlib to call the other entry points.
If I may describe what I am trying to achieve.
Using a Lua script we convert binary Lua code to WIndows resources and
place these resources in DLLs. (See
http://www.spinifex.net/db/public/bin2res.zip)
The 5.1 CPATH scheme is almost perfect for using resource loaded scripts.
In development require 'myscript' -- uses myscript.lua
In release require 'myscript' -- loads myscript.dll , the dll simply
loads and executes
the script from a windows resource.
A different DLL for each module script is not so good. I will reread the spec.
and code on PRELOAD.
DB