所以首先我加载我需要的 DLL
local ffi = require("ffi")
local theDLL = ffi.load("thisDLL")
在 ffi cdef 我有两种不同的结构
ffi.cdef [[
typedef struct StructSession StructSession;
typedef struct {
/*
* begin_proj callback
*/
bool (__cdecl *begin_proj)(char *proj);
/*
* save_proj_state
*/
bool (__cdecl *save_proj_state)(unsigned char **buffer, int *len);
} StructCallbacks;
我在cdef中也有这个功能
__declspec(dllexport) int __cdecl start_session(StructSession **session,
StructCallbacks *cb);
现在我想调用这个函数
print(theDLL.start_session(a,b))
vars a 和 b 显然是占位符,问题是我怎样才能传递函数需要的结构?假设我们让 StructSession 正常工作,是否对 StructCallbacks 内的函数进行回调甚至是可能的?