我尝试包装几个 .c 文件,以便通过 Python 进行访问。如果我想访问所有文件的所有函数,我是否必须在接口(interface)文件中提及所有函数?
最佳答案
是的。但有一个快捷方式:SWIG 可以解析头文件 (.h
)。所以大多数时候,您可以使用这个接口(interface)文件:
%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后方的懒人”
关于python - 是否有必要使用 SWIG 在接口(interface)文件中提及包装的 .c 文件的所有函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32053325/