【问题标题】:LuaJIT FFI cdef doesn't understand 'class'?LuaJIT FFI cdef 不理解“类”?
【发布时间】:2015-10-13 01:00:09
【问题描述】:
class Myuser * MyClient_GetMyUser(AUser aUser);

这是尝试使用 ffi.cdef 声明该函数的错误:

Error: dllImport.lua:861: declaration specifier expected near 'class' at line 20

这怎么可能?如果我必须在 cdef 中声明“类”,我将如何着手?

【问题讨论】:

    标签: c++ c lua ffi luajit


    【解决方案1】:

    class 是 C++ 关键字。它在 C 中不存在。LuaJIT 需要 C 代码,而不是 FFI 块中的 C++ 代码。

    至于如何解决这个问题,这取决于你在做什么。要么将其设为 C struct,要么找到其他方式来访问它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-07
      • 2016-06-04
      • 2012-09-01
      • 2018-01-21
      • 2012-12-10
      • 1970-01-01
      • 2021-10-23
      • 1970-01-01
      相关资源
      最近更新 更多