lua-users home
lua-l archive

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

There are a few known reasons for crashing applications, whose parts are
built against different C runtime libraries, e.g., using different
implementations of realloc/free, or different definitions of FILE, etc.
The case I'm about to tell is different in that the application parts
use the same C-runtime, but 2 instances of (the same) Lua library.

There is a standard lua.exe, dynamically linked against standard
lua5.1.dll, and foo.dll, *statically* linked with Lua 5.1 library.
foo.dll may be very simple, it just should contain a function
luaopen_foo and luaL_register(L, "foo", foo) call within it.

The following 2 tests lead to crash:

-- test1.lua
require "strict"
require "foo" --> crash

Now, if foo implements a function foo.rawset (usual rawset for tables),
then the following test also crashes the application:

-- test2.lua
require "foo"
foo.rawset({a=nil}, "abc", true) --> no crash
foo.rawset({}, "abc", true) --> crash

My investigation (which would be better verified by somebody with
more knowledge in Lua sources) shows that these crashes are due to
foo.dll attempting access to dummynode_ static variable in Lua5.1.dll.

Is it worth the effort to be fixed?
(It seems, making dummynode_ a member in struct Table would do; there
are surely many other means).