lua-users home
lua-l archive

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


Hello,

Recently I got a bugreport (a segfault in "LuaFAR for Editor"). After some debugging it appeared that lua5.1.dll from Lua Binaries produces a segfault after a DLL built with Borland Delphi (or C++ Builder) is loaded. (My lua5.1.dll built with GCC is OK in this respect).

Here is a test case
--------------------------------------------------------------
-- (1) lib.dll: libfile.cpp
#include <vcl.h>
extern "C" {
#include <lua.h>
int luaopen_lib(lua_State* L) { return 0; }
}

-- (2) lib.dll: lib.def
EXPORTS
  luaopen_lib = _luaopen_lib

-- (3) test.lua
require ("lib")
loadstring ("local var = 0x80000000")
--------------------------------------------------------------

What's interesting, segfaults occur only when a number assigned to 'var' is >= 0x80000000.

BTW, Delphi DLL doesn't have to be Lua module (as in my test case), it is sufficient that it is loaded by the application before executing the Lua code above.

--
Shmuel