<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="auto">No, it's `typedef interface Foo Foo` and without further definition.<div>It works for `open` I mean the returned foo, it could use as _Foo normally (_Foo contains methods).</div><div>But I can't pass the foo returns from `open` to `dosomething` . It's actully a _Foo because I use ConvertToSubClassCode for `Foo`<br><br><br></div></div><div style="line-height:1.5"><br><br>-------- 原始邮件 --------<br>发件人: Phil Thompson <phil@riverbankcomputing.com><br>日期: 2023年4月30日周日 22:27<br>收件人: Weitian Leung <Just_Fancy@live.com><br>抄送: pyqt@riverbankcomputing.com<br>主    题: Re: ConvertToSubClassCode for IDispatch<br><blockquote>On 30/04/2023 14:39, Weitian Leung wrote:<br>> Hello,<br>>      I have a IDispatch related sdk header, say it contains two<br>> IDispatch interfaces:<br>> ```<br>> interface _Foo : public IDispatch {…};<br>> typedef interface Foo Foo; // No definition at all<br>> ```<br><br>Do you mean...<br><br>typedef interface _Foo Foo;<br><br>> `Foo` can be QueryInterface from `_Foo` in C++ (or just do a cast),<br>> and for this case I asume they are just the same class.<br>> <br>> As the sdk internal only uses the Foo interface, such as:<br>> ```<br>> interface Bar : public IDispatch<br>> {<br>>       bool open(…, Foo** out);<br>>       void dosomething(Foo* f);<br>> };<br>> ```<br>> <br>> So I use ConvertToSubClassCode to resolve the buggy sdk:<br>> ```<br>>     class Foo /Abstract,NoDefaultCtors/<br>>     {<br>>     %ConvertToSubClassCode<br>>         sipType = sipType__Foo;<br>>     %End<br>>     };<br>> ```<br><br>As Foo above doesn't have a super-class, and nothing sub-classes it, the <br>%ConvertToSubClassCode isn't having any effect.<br><br>> It works for `open`, but not for `dosomething` due to<br>> ConvertToSubClassCode make `open` returns a `_Foo`, they have no<br>> inherits from python’s view.<br><br>Sorry, I don't understand what you mean. What do you mean by "it works"?<br><br>> I can’t change the C++ sdk as it out of my control.<br>> So is there any chance to make SIP works for such case?<br><br>Your example is too incomplete to say.<br><br>Phil<br></blockquote></div>