我可以在“真正懒惰”的SWIG界面文件中禁止类/函数包含吗?

时间:2015-08-28 13:42:30

标签: c++ swig

我使用SWIG tutorial中的“真正懒惰”方法成功地为C#包装了一个C ++库。它看起来像这样:

%module example
%{
/* Includes the header in the wrapper code */
#include "header1.h"
#include "header2.h"
%}

/* Parse the header file to generate wrappers */
%include "header1.h"
%include "header2.h"

但是,这包括一两个我不想要的方法和类。我可以在%include之后禁止包含类和/或方法吗?有点像添加:

%ignore Math.functionNotToInclude(int x, int y);

1 个答案:

答案 0 :(得分:0)

是的,你可以,但是你将%ignore指令放在%include ...

之前
%ignore functionNotToInclude; // note, not the whole signature
%include "header2.h"

有关详细信息,请参阅SWIG 3.0手册中的"Simple renaming of specific identifiers"。 (忽略被视为重命名的特殊情况。)