LuaJIT如何用FFI包装C数据类型?

时间:2018-09-13 03:14:41

标签: c lua ffi luajit cross-language

假设我有以下LuaJIT代码:

local ffi = require "ffi"

ffi.cdef[[
    typedef struct { int num; } container;
]]

local a = ffi.new("container")
a.num = 10

library.doSomethingTo(a)

,假设library.doSomethingTo由以下C代码定义:

int doSomethingDo(lua_State *L) {
    //code here
}

要使//code here打印10,需要什么代码library.doSomethingTo(a)

0 个答案:

没有答案