<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="auto">Yes it means compiles and runs fine.<div>What did you mean `wrapped _Foo`? </div><div>The _Foo just write as normal class, no special code in sip file.<br><br><br><br><br></div></div><div style="line-height:1.5"><br><br>-------- 原始邮件 --------<br>发件人: Phil Thompson <phil@riverbankcomputing.com><br>日期: 2023年4月30日周日 23:42<br>收件人: "‪‪‪‪just_fancy@live.com‬‬‬‬" <just_fancy@live.com><br>抄送: pyqt@riverbankcomputing.com<br>主    题: Re: 回复:ConvertToSubClassCode for IDispatch<br>On 30/04/2023 16:10, ‪‪‪‪just_fancy@live.com‬‬‬‬ wrote:<br>> No, it's `typedef interface Foo Foo` and without further definition.<br>> It works for `open` I mean the returned foo, it could use as _Foo<br>> normally (_Foo contains methods).<br>> But I can't pass the foo returns from `open` to `dosomething` . It's<br>> actully a _Foo because I use ConvertToSubClassCode for `Foo`<br><br>"It works" means it compiles or it runs correctly?<br><br>Have you wrapped _Foo?<br><br>Phil<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>> <br>>> 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<br>>> 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,<br>>> 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<br>>> 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></div>