lua-users home
lua-l archive

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


As a frequent user of luasocket on windows, I have built a bundled dll, with all the lua code as resources. Neat and tidy, with a small change to loadlib (look for resources after lua, before luaopen_). This simplifies packaging, and can be implemented as a seperate library that hooks into the package loaders (it just needs copies of some of loadlib's static fn's). I don't know if such a scheme translates readily to other os's : it seems a good fit for windows : each lua script is embedded in the dll as RCDATA with the name "luamodule_a.b.c". The only limitation is that module names are case-insensitive.

My problem is this : I wish to combine 3 packages (socket, mime and ltn12) into a single dll. To do this, I've added a table "alias" to package, so if package.alias["mime"] = "socket", the c loader will look for mime in socket.dll, if it can't find it in mime.dll. This again can be implemented outside loadlib, at the cost of some code duplication.

Any problems with this approach ? It would certainly simplify distribution on windows.