无法包装头文件中定义的简单 class
Cannot wrap simple class defined in header file
我卡在用 csharp 包装 .so 文件的开始阶段。但是,如果我尝试使用提供的包含 class 的 h 文件之一创建包装器,则会出现错误。我认为这是因为 __attribute__ ((visibility ("default") ))
但我无法弄清楚。以前有人做过吗?
我在 Test.h 中定义了一个 class,如下所示:
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"
我卡在用 csharp 包装 .so 文件的开始阶段。但是,如果我尝试使用提供的包含 class 的 h 文件之一创建包装器,则会出现错误。我认为这是因为 __attribute__ ((visibility ("default") ))
但我无法弄清楚。以前有人做过吗?
我在 Test.h 中定义了一个 class,如下所示:
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"