lua-users home
lua-l archive

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

I have found some confusion on LuaBinaries about this, and the unfortunate thing is that, under Windows, it doesn't work properly if an application which uses Lua tries to load some modules (eg. luasocket) which use lua51.dll and others (eg. luasql) which use lua5.1.dll. (These are just examples, I am not saying these modules do this any more).

The problem is, first you need both DLLs downloaded, which is a pain, and the two different DLLs create different address spaces, and thus you have two versions of Lua running. Effectively this sets you up for a crash fairly promptly.

In my redistributions of Lua, I have used lua5.1.dll, which at least some modules use as well, and it seems more logical, if you ever do get up to Lua version 50.

However the Makefile for stock Lua has lua51.dll as the target for a "mingw" build, so I suppose you could argue that lua51.dll is the effective official name.

I notice that in LuaBinaries one file I checked, namely:

actually supplies both DLL names!

Whilst this might be convenient, it is confusing, and like I said before, if you have something like:

main program -> uses lua5.1.dll -> require "luasocket" -> uses lua51.dll

... you will probably get a crash as they are allocating memory from different address spaces.

My recommendation is to standardize on lua5.1.dll, update LuaBinaries to use that and only that, and make all other modules depend on that name, and not some on one and some on the other. (This requires changing the Makefile for the stock Lua distribution as well).

- Nick