lua-users home
lua-l archive

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


On 2021-11-25 14:22, Roberto Ierusalimschy wrote:
Thanks. I had just got this issue sorted. But I have another. Dynamic
loading of C modules causes a segmentation fault after the loaded code has
run.

This:

  local path, cpath in package
  print (path, cpath)
  local x = require "riscos"
  print (x.version)

produces this:

rlua:lib.?,?    rlua:solib.?/so,?/so
RiscLua 544VFP-A

Fatal signal received: Segmentation fault

I am assuming the 'RiscLua 544VFP-A' was written by the module's
open function, is that right? What else does it do?

No, it is

     print (x.version)

that produces that string. That is the strange thing. Quite complex programs that put windows on the desktop run correctly. The bad things happen when the programs close down.

There were many changes in the code around 'require' from 5.3 to 5.4,
but almost all of them were related to string manipulation done
before the open function is called (e.g., building file names and
error messages).

Could any of those changes have left something for free_unlocked() to stumble over? The last four functions on the stack are free_unlocked(), __free(), do_dlclose() and __dlclose(). They are not part of Lua, are they?

--Gavin