lua-users home
lua-l archive

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

> 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.

-- Roberto