【发布时间】:2015-02-15 22:48:33
【问题描述】:
我有一个从库类派生的 C++ 类。
class Derived : public LargeLibrary::ParentWithHugeInterface
{
// add some methods
// override some other methods
};
这个库有自己的 Python 和 Perl 绑定(使用 SWIG 创建)。现在我想为我自己的类创建类似的绑定。我可以让我的绑定了解LargeLibrary 的遗留问题,以便将Derived 与LargeLibrary 的方法一起使用并获取其父接口吗?
更新:
我找到了 Python 的 PyTypeObject* PyTypeObject.tp_base 插槽,但是我仍然不明白如何使用它。
【问题讨论】: