[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Update #4 to Lua 5.1-work3 loadlib cleanups
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 23 Dec 2004 14:46:48 -0200
> The loaded module handles are useful for a number of API calls. What
> about adding another table to package that maintains the handles and
> keyed by the file name e.g. pak. i.e. package.clib['filename'] =
> (HMODULE)libhabdle This means they are accessible by C code and they do
> not have to be reestablished.
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).
> The problem I see with this is that it is not easy (or possible) to
> put luaopen_socket and luaopen_sockethttp in the same DLL. Is this so,
> or have I missed something obvious? For Win32 this would seem to be an
> unnecessary DLL breeder. Any ideas and how this might be done?
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.