是否有必要使用SWIG在接口文件中提及包装的.c文件的所有功能? [英] Is it necessary to mention all functions of the wrapped .c file in the interface file using SWIG?

查看:47
本文介绍了是否有必要使用SWIG在接口文件中提及包装的.c文件的所有功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试包装几个.c文件以通过Python进行访问.如果要访问所有文件的所有功能,是否必须在界面文件中提及所有功能?

I try to wrap several .c files to make the accessible via Python. If I want to access all functions of all files do I have to mention all the functions in the interface file?

推荐答案

是.但是有一个捷径:SWIG可以解析标头( .h )文件.因此,在大多数情况下,您可以使用以下接口文件:

Yes. But there is a shortcut: SWIG can parse header (.h) files. So most of the time, you can get away with this interface file:

 %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上搜索真正懒惰的SWIG".org/tutorial.html

这篇关于是否有必要使用SWIG在接口文件中提及包装的.c文件的所有功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆