diff options
| author | ruki <[email protected]> | 2021-09-20 21:07:46 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-20 21:07:46 +0800 |
| commit | 8a177cf0047b61c1fc5085138b7d268e500fe909 (patch) | |
| tree | 322dda8a0bc474b1e7a7e59956c879fcb0008d38 /xmake | |
| parent | ef3180fdb0b441cbaecd00a2f9dfebb1addd421c (diff) | |
add libc.memcpy
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/core/base/libc.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/xmake/core/base/libc.lua b/xmake/core/base/libc.lua index 914065f2e..4b3a9f3ec 100644 --- a/xmake/core/base/libc.lua +++ b/xmake/core/base/libc.lua @@ -23,7 +23,8 @@ local libc = libc or {} -- save original interfaces libc._malloc = libc._malloc or libc.malloc -libc._free = libc._free or libc.free +libc._free = libc._free or libc.free +libc._memcpy = libc._memcpy or libc.memcpy -- load modules local ffi = xmake._LUAJIT and require("ffi") @@ -52,5 +53,13 @@ function libc.free(data) end end +function libc.memcpy(dst, src, size) + if ffi then + return ffi.copy(dst, src, size) + else + return libc._memcpy(dst, src, size) + end +end + -- return module: libc return libc |
