PyBindgen support for wrapping pure virtual operator[]
(pasted from earlier email)
>> Apologies for just firing off an email to you like this, but you seem to be the resident expert / author of pybindgen.. which
>> seems to work very nicely so far, with one surprising problem/omission.
>>
>> I'm trying to wrap a third party library and just noticed that things aren't compiling because of a pure virtual function isn't
>> getting wrapped. On closer inspection it seems that issue is not lack of support for pure virtual functions, but that
>> "operator[]" is ignored by the pybindgen.
>> you know if that is the case or if there are reasons this is tricky? I'm wondering if someone just forgot about that operator!
>> Also, do you know of any workarounds if we aren't in control of the C++ source code (i.e. just have headers)
>
> operator[] isn't supported yet in pybindgen.
>
> But I don't see why it fails to create the bindings unless a base class has a pure virtual operator[]. I can't offer advice
> without more details.
>
> Also please consider using launchpad "answers" to ask this question: https:/
> the answer is useful, others can learn (FAQ).
This is indeed a pure virtual function. Basically, the generated C wrapper code ends up instantiating the class, even though it is an abstract base class. I think this would work correctly for any other virtual void =0 function (pure virtual methods are supported), but since the parser completely skips the operator[] method I believe any class with a method signature of:
virtual void* operator[](int) = 0
will fail.
Just wondering how much work it would be to support such a situation, given that many operators are already supported as are pure virtual functions.
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- PyBindGen Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask aaaaaaaa1 for more information if necessary.