【发布时间】:2013-11-11 22:18:19
【问题描述】:
我的共享库中有一个函数指针,用于调用主引擎。 (效果很好):func_ptr
我还有一个 python 模块,我使用 boost::python::import("module") 在我的程序中导入它
我的 python 模块中的一个函数:
def wrapper(function):
function('TEST ')
和我的 c++ 程序中的一个函数:
int function(char const *msg){
{
func_ptr(msg); //this line crashes
return 1;
}
当我用
调用我的包装函数时module.attr("wrapper")(boost::python::make_function(function))
它在我的 c++ 函数中崩溃。 (段错误)
gdb 产生类似的东西:
如何使它工作?泰!
【问题讨论】:
标签: c++ python pointers boost boost-python