我已经关闭了源C++库,它提供了与E/P>等价的代码头文件
class CSomething
{
public:
void getParams( unsigned char & u8OutParamOne,
unsigned char & u8OutParamTwo ) const;
private:
unsigned char u8OutParamOne_,
unsigned char u8OutParamTwo_,
};
我正试图将其公开给Python,我的包装代码如下:
^{pr2}$现在我尝试在Python中使用它,但它失败得很厉害:
one, two = 0, 0
CSomething.getParams(one, two)
结果是:
ArgumentError: Python argument types in
CSomething.getParams(CSomething, int, int)
did not match C++ signature:
getParams(CSomething {lvalue}, unsigned char {lvalue} one, unsigned char {lvalue} two)
我需要在Boost.Python包装器代码还是Python代码使其工作?我怎么加一些Boost.Python自动将PyInt
转换为unsigned char
,反之亦然?在
<^ > ^ {< CD3>}的^ {< CD4>}函数的参数不是C++类引用。在C++中,输出不同: ^{pr2}$Boost.Python
正在抱怨丢失的lvalue
参数,这个概念在Python中不存在:你有几个选择:
a)包装
CSomething.getParams
函数以返回新参数值的元组:b)包装
CSomething.getParams
函数以接受类实例作为参数:相关问题 更多 >
编程相关推荐