无法包装标题文件中定义的简单类
Cannot wrap simple class defined in header file
我被卡在用csharp包装.so文件的开始阶段。但是,如果我尝试使用包含类的提供的H文件之一创建包装器,那么我会遇到错误。我认为这是因为__attribute__ ((visibility ("default") ))
,但我无法弄清楚。有没有人做过这个?
我在测试中定义了一个类别。H如下:
class Test
{
public:
__attribute__ ((visibility ("default") )) Test();
__attribute__ ((visibility ("default") )) ~Test();
};
我定义了一个接口文件,正如您想象的那样,该文件也很简单。
%module Test
%{
#include "Test.h"
%}
/* Let's just grab the original header file here */
%include "Test.h"
执行命令swig -c++ -csharp -v test.i
时,我会收到错误消息:
Test.h:4: Error: Syntax error in input(3).
swig对__attribute__
一无所知。您需要用它包装:
%module Test
%{
#include "Test.h"
%}
#define __attribute__(x)
/* Let's just grab the original header file here */
%include "Test.h"
相关文章:
- 查找定义我的 C/C++ 函数/宏的文件比'grep'更简单的方法
- 当使用Lua作为嵌入式语言(比如c++)时,有什么简单/方便的方法可以找到变量在Lua中的定义位置吗
- 编译简单的多文件类程序时出现未定义的引用错误
- 自定义层 API (TensorRT 2.1) 上的简单示例?
- 使用自定义简单 Mapi DLL,无需安装 Outlook
- 未定义的卫生化无法检测到简单的堆栈外误差
- 带有运算符的简单用户定义类 = 重载代码崩溃
- 无法包装标题文件中定义的简单类
- 虚拟关键字的使用与C++中的简单重新定义
- 在自定义 C/C++ 程序中获取 PPP0 接口 Tx/Rx 字节的最简单方法是什么?
- 为depth_first_search定义颜色图的最简单方法
- 如果将功能的非常简单的定义移动到.cpp,则编译时间的减少是多少
- 是否有更简单的方法来定义C 中的for循环中的条件
- cocos2d-x 编辑框的简单示例,错误未定义引用
- C 未解决的外部词,具有简单的类定义
- 简单QT程序中的未定义参考
- 用C++编写的 MetaTrader 自定义指标的简单示例
- 我怎样才能以一种良好而简单的方式定义这个值
- 创建自定义简单Mapi DLL,执行时失败
- 用c++定义简单的windows窗体插件