使绑定知道祖先绑定

Make bindings aware of ancestor bindings

本文关键字:绑定 祖先      更新时间:2023-10-16

我有一个从库类派生的C++类。

class Derived : public LargeLibrary::ParentWithHugeInterface
{
  // add some methods
  // override some other methods
};

这个库有自己的Python和Perl绑定(使用SWIG创建)。现在我想为自己的类创建类似的绑定。我可以让我的绑定知道LargeLibrary的遗留问题,以便将DerivedLargeLibrary的方法一起使用并获得其父级的接口吗?

更新:我已经找到了Python的PyTypeObject* PyTypeObject.tp_base插槽,但我仍然不知道如何使用它。

最后,我找到了解决方案。

这就像在接口文件中添加%import "LargeLibrary.i"一样简单。