summaryrefslogtreecommitdiff
path: root/xmake/core/base/libc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-05 12:15:58 +0800
committerGitHub <[email protected]>2025-09-05 12:15:58 +0800
commit9f6d91af31ffc4bbbc0d04533786a0954afee2bf (patch)
treef30814d17a5bd000fe4e1a2186b3301c99123f0a /xmake/core/base/libc.lua
parent1738f7b9d1a336791216c6874c44d386f74cfda4 (diff)
parentca139f4b270b402fb13652193057ca8dffe6fd4d (diff)
Merge pull request #6765 from xmake-io/thread
Improve bin2c to use native thread
Diffstat (limited to 'xmake/core/base/libc.lua')
-rw-r--r--xmake/core/base/libc.lua10
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