是否有必要在使用 SWIG 的接口文件中提及包装的 .c 文件的所有功能?
Is it necessary to mention all functions of the wrapped .c file in the interface file using SWIG?
我尝试打包几个 .c 文件以通过 Python 访问。如果我想访问所有文件的所有功能,是否必须在接口文件中提及所有功能?
是的。但是有一个捷径:SWIG 可以解析头 (.h
) 文件。所以大多数时候,你可以摆脱这个接口文件:
%module example
%{
/* Includes the header in the wrapper code */
#include "header.h"
%}
/* Parse the header file to generate wrappers */
%include "header.h"
有关详细信息,请在 http://www.swig.org/tutorial.html
搜索 "SWIG for the truly lazy"
我尝试打包几个 .c 文件以通过 Python 访问。如果我想访问所有文件的所有功能,是否必须在接口文件中提及所有功能?
是的。但是有一个捷径:SWIG 可以解析头 (.h
) 文件。所以大多数时候,你可以摆脱这个接口文件:
%module example
%{
/* Includes the header in the wrapper code */
#include "header.h"
%}
/* Parse the header file to generate wrappers */
%include "header.h"
有关详细信息,请在 http://www.swig.org/tutorial.html
搜索 "SWIG for the truly lazy"