我有以下代码:
#include "boost_facade.h"
BOOST_PYTHON_MODULE (libdtlinux) {
using namespace boost::python;
class_<DtSearch>("DtSearch")
.def("DoSearch", &DtSearch::DoSearch)
.def("CreateIndex", &DtSearch::CreateIndex);
}
我想做的是让Boost自动添加class DtSearch
和所有子方法,而不必在BOOST_PYTHON_MODULE
中逐个定义它们。你知道吗
有没有办法在头文件中包含所有对象,或者我需要像现在这样指定它们?你知道吗
更新
SWIG有我正在寻找的功能,但是我需要使用Boost.Python版本. 以下是swig示例:
%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下,用于真正懒惰的人
目前没有回答
相关问题 更多 >
编程相关推荐