上QQ阅读APP看书,第一时间看更新
LuaJIT's FFI library
LuaJIT's FFI library makes it easy to call C functions and C data structures by parsing C declarations:
local ffi = require("ffi")
Load LuaJIT's FF library
ffi.cdef[[
int printf(const char *fmt, ...);
]]
Add a C declaration for the function.
ffi.C.printf("Hello %s!", "world")
Call the named C function. Simple!