[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: ConvertToSubClassCode for IDispatch
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2023-04-30 14:27:20
Message-ID: 2f2b25442d4528e1b25dbc97865c9b76 () riverbankcomputing ! com
[Download RAW message or body]

On 30/04/2023 14:39, Weitian Leung wrote:
> Hello,
>      I have a IDispatch related sdk header, say it contains two
> IDispatch interfaces:
> ```
> interface _Foo : public IDispatch {…};
> typedef interface Foo Foo; // No definition at all
> ```

Do you mean...

typedef interface _Foo Foo;

> `Foo` can be QueryInterface from `_Foo` in C++ (or just do a cast),
> and for this case I asume they are just the same class.
> 
> As the sdk internal only uses the Foo interface, such as:
> ```
> interface Bar : public IDispatch
> {
>       bool open(…, Foo** out);
>       void dosomething(Foo* f);
> };
> ```
> 
> So I use ConvertToSubClassCode to resolve the buggy sdk:
> ```
>     class Foo /Abstract,NoDefaultCtors/
>     {
>     %ConvertToSubClassCode
>         sipType = sipType__Foo;
>     %End
>     };
> ```

As Foo above doesn't have a super-class, and nothing sub-classes it, the 
%ConvertToSubClassCode isn't having any effect.

> It works for `open`, but not for `dosomething` due to
> ConvertToSubClassCode make `open` returns a `_Foo`, they have no
> inherits from python's view.

Sorry, I don't understand what you mean. What do you mean by "it works"?

> I can't change the C++ sdk as it out of my control.
> So is there any chance to make SIP works for such case?

Your example is too incomplete to say.

Phil
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic