我使用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);
答案 0 :(得分:0)
是的,你可以,但是你将%ignore
指令放在%include
...
%ignore functionNotToInclude; // note, not the whole signature
%include "header2.h"
有关详细信息,请参阅SWIG 3.0手册中的"Simple renaming of specific identifiers"。 (忽略被视为重命名的特殊情况。)