Add Data:getFFIPointer. Similar to Data:getPointer but returns a cdata pointer directly (or nil if the FFI isn't available).

It should be preferred instead of Data:getPointer because the latter uses lightuserdata which can't store more all possible memory addresses on some new arm64 architectures, when LuaJIT is used.
This commit is contained in:
Alex Szpakowski
2019-07-20 10:47:58 -03:00
parent d700800888
commit cb4b45dcf1
17 changed files with 170 additions and 64 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
--]]
local RandomGenerator_mt, ffifuncspointer = ...
local RandomGenerator_mt, ffifuncspointer_str = ...
local RandomGenerator = RandomGenerator_mt.__index
local type, tonumber, error = type, tonumber, error
@@ -67,7 +67,7 @@ typedef struct FFI_RandomGenerator
} FFI_RandomGenerator;
]])
local ffifuncs = ffi.cast("FFI_RandomGenerator *", ffifuncspointer)
local ffifuncs = ffi.cast("FFI_RandomGenerator **", ffifuncspointer_str)[0]
-- Overwrite some regular love.math functions with FFI implementations.