Env: Actually use the full ffi.load signature in our overload

We *do* actually use the optional global argument sometime...
Namely, for librt in ffi/posix_h.
c.f., https://github.com/koreader/koreader-base/pull/1586#issuecomment-1637184501
reviewable/pr10710/r1
NiLuJe 10 months ago
parent 8e063d5b39
commit d350418367

@ -15,8 +15,8 @@ if ffi.os == "Windows" then
end
local ffi_load = ffi.load
-- patch ffi.load for thirdparty luajit libraries
ffi.load = function(lib)
io.write("ffi.load: ", lib, "\n")
ffi.load = function(lib, global)
io.write("ffi.load: ", lib, global and " (RTLD_GLOBAL)\n" or "\n")
local loaded, re = pcall(ffi_load, lib)
if loaded then return re end
@ -27,6 +27,6 @@ ffi.load = function(lib)
error("Not able to load dynamic library: " .. lib)
else
io.write("ffi.load (assisted searchpath): ", lib_path, "\n")
return ffi_load(lib_path)
return ffi_load(lib_path, global)
end
end

Loading…
Cancel
Save