diff options
| author | ruki <[email protected]> | 2021-09-18 13:45:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-18 13:45:41 +0800 |
| commit | 7065563ba5be2117b8ed9d194204d33ff73291bd (patch) | |
| tree | c0db81b9b71729cd403b2c6e166453920146638f | |
| parent | 52164d9f27178104817dd5478604ea433b543964 (diff) | |
disable bytes for lua
| -rw-r--r-- | tests/modules/bytes/test.lua | 4 | ||||
| -rw-r--r-- | xmake/core/base/bytes.lua | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/modules/bytes/test.lua b/tests/modules/bytes/test.lua index 4cb272c94..aa29e3493 100644 --- a/tests/modules/bytes/test.lua +++ b/tests/modules/bytes/test.lua @@ -1,5 +1,9 @@ import("core.base.bytes") +if not xmake.luajit() then + return +end + function test_ctor(t) t:are_equal(bytes("123456789"):str(), "123456789") t:are_equal(bytes(bytes("123456789")):str(), "123456789") diff --git a/xmake/core/base/bytes.lua b/xmake/core/base/bytes.lua index 6cebbdf2b..359a67f36 100644 --- a/xmake/core/base/bytes.lua +++ b/xmake/core/base/bytes.lua @@ -24,16 +24,18 @@ local _instance = _instance or {} -- load modules local bit = require("base/bit") -local ffi = require("ffi") +local ffi = xmake._LUAJIT and require("ffi") or nil local os = require("base/os") local utils = require("base/utils") local todisplay = require("base/todisplay") -- define ffi interfaces -ffi.cdef[[ - void* malloc(size_t size); - void free(void* data); -]] +if ffi then + ffi.cdef[[ + void* malloc(size_t size); + void free(void* data); + ]] +end -- new a bytes instance -- |
