lcpp - a C-PreProcessor for Lua 5.1 and LuaJIT ffi integration
This module offers a standard preprocessor for C code in pure Lua.
The primary usecase is to enable LuaJIT ffi preprocessing.
But you can also preprocess any other stuff (even Lua code itself)
-- load lcpp (ffi.cdef wrapper turned on per default)
local lcpp = require("lcpp")
-- just use LuaJIT ffi and lcpp together
ffi.cdef("#include <your_header.h>")
-- or compile some code by hand
local result = lcpp.compile("...")
local out = lcpp.compile([[
#define MAXPATH 260
typedef struct somestruct_t {
void* base;
size_t size;
wchar_t path[MAXPATH];
} t_exe;
]])
请发表评论