lua-users home
lua-l archive

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


Virgil Smith wrote:

The question keeps coming up on this list of where to get Lua DLL binaries
for Windows, and myself and others keep pointing out that there not on the
wiki (or weren't previously), but that its just <<so easy>> to make that it
really didn't matter.

However, if library contributors are stumbling over libraries being
incompatible for this reason then I strongly suggest that someone put forth
a "standard" DLL onto the Wiki.

Does anyone know of any issues that would complicate this?
(I expect that those who have put forth open libraries would know what
issues could cause disagreements, linking problems, license statement
problems, etc.)

It would be much better to make a decision about standard lua5 ABI and post it as a new LTN. That should explain how dlls (and .so files) are named, which functions they export and in which order they should be called to load a new binary module.

Something like http://lua-users.org/wiki/LuaBinaryModules but for lua5
By the way, luacheia team has some experience in making support for different binary modules with lua, so they can make initial version of this document

The following example below uses luafs module from luacheia and dll from wxlua (this example shows list of files from the current directory in html widget as a table). It uses vanilla lua 5.0 compiled with mingw. wxlua links with lua50dll.dll, luafs links with liblua-5.dll and liblualib-5.dll, this is not very good and can cause problems but this simple example works and shows that different modules can work together. If all the modules authors used the same names for dll's and functions, it would not require hacking makefiles and recompiling at all.

-------------------------------------------------
loadlib("luafs.dll", "luaLM_import")()
wx = loadlib("wxLuaDLL.dll", "wxLua")()

htmlTextPage = "<html><head><body><table border = 1>" ..
	"<tr><td>file name<td>file size"

for k, v in fs.listdir(".") do
	htmlTextPage = htmlTextPage ..
		"<tr><td>" .. v .. "<td>" .. fs.fileinfo(v).size
end

htmlTextPage = htmlTextPage .. "</table></body></html>"

frame = wx.wxFrame(wx.wxNull, -1, "Files from the current directory",
	wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE)

html = wx.wxLuaHtmlWindow(frame)

html:SetPage(htmlTextPage)

frame:Show(wx.TRUE)

wx.wxGetBaseApp():MainLoop()
-------------------------------------------------

I don't use luacheia5.exe as I want to be able to use a set of other patches (continue keyword support and support for hextradecimal constants). I would propose to replace ".dll" extension to ".so" for lua5 binary modules, so scripts can be used unmodified both in windows and linux. Also, as you see, initialization of these two libraries is a bit different now, I would like to see some convention about naming loadable module entry point functions and a common way of additional libraries namespaces initialization.