- Learning Functional Programming in Go
- Lex Sheehan
- 52字
- 2025-02-27 05:14:32
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!