我有一个从库类派生的 C++ 类。
class Derived : public LargeLibrary::ParentWithHugeInterface
{
// add some methods
// override some other methods
};
这个库有自己的 Python 和 Perl 绑定(bind)(使用 SWIG 创建)。现在我想为我自己的类创建类似的绑定(bind)。我能否让我的绑定(bind)了解 LargeLibrary
的遗留问题,以便将 Derived
与 LargeLibrary
的方法一起使用并获取其父接口(interface)?
更新:
我找到了 Python 的 PyTypeObject* PyTypeObject.tp_base
插槽,但我仍然无法理解如何使用它。
最佳答案
终于,我找到了解决方案。
只要在接口(interface)文件中添加%import "LargeLibrary.i"
就可以了。
关于python - 使绑定(bind)了解祖先绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28532168/