From d350418367ddf39d752d05e0587e562d7d4af2c4 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 17 Jul 2023 18:28:40 +0200 Subject: [PATCH] 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 --- setupkoenv.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setupkoenv.lua b/setupkoenv.lua index be1b2e228..5a55a5d7a 100644 --- a/setupkoenv.lua +++ b/setupkoenv.lua @@ -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