diff options
Diffstat (limited to 'xmake/core/base/libc.lua')
| -rw-r--r-- | xmake/core/base/libc.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/xmake/core/base/libc.lua b/xmake/core/base/libc.lua index 141bd4f64..f9a12931e 100644 --- a/xmake/core/base/libc.lua +++ b/xmake/core/base/libc.lua @@ -121,8 +121,9 @@ function libc.setbyte(data, offset, value) end function libc.dataptr(data, opt) - if ffi then - if opt and opt.gc then + opt = opt or {} + if ffi and opt.ffi ~= false then + if opt.gc then return ffi.gc(ffi.cast("unsigned char*", data), ffi.C.free) else return ffi.cast("unsigned char*", data) @@ -132,8 +133,9 @@ function libc.dataptr(data, opt) end end -function libc.ptraddr(data) - if ffi then +function libc.ptraddr(data, opt) + opt = opt or {} + if ffi and opt.ffi ~= false then return tonumber(ffi.cast('unsigned long long', data)) else return data |
