<div dir="ltr"><div>Hi,</div><div>    I'm noob in SIP. Say I have two abstract interfaces and one method to create the object:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>struct IUnknown /Abstract/<br>{<br>    virtual void AddRef() = 0;<br>    virtual void Release() = 0;<br><br>    %GCClearCode<br>        printf("GCClearCode\n");<br>    %End<br>};<br><br>struct IDemo : public IUnknown /Abstract/<br>{<br>    virtual void SayHi() = 0;<br>};</div></blockquote><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>void createDemo(IDemo **demo /Out/); <br></div></blockquote><div><br></div><div><br></div><div>Using in python side:</div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace,"Droid Sans Fallback";font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(212,212,212)">idemo = demo.createDemo()</span></div><div><span style="color:rgb(212,212,212)">idemo = </span><span style="color:rgb(86,156,214)">None</span></div></div></div><div><br></div><div>Is it possible to write some handwritten code that call the Release method when idemo set to None or when  idemo doing GC?</div><div>Or if we can call AddRef automatically when idemo assign to another object.</div><div><br></div><div>I known that on python side we can call AddRef/Release to make it works, but I want the code more python's way.</div><div><br></div><div>The %GCClearCode handwritten code never called in this case. <br></div><div>And the %GCTraverseCode handwritten code only call when the object make an assignment to other object.<br></div><div> Am I missing something?</div><div><br></div><div>Please check the full code in the  attached file.<br></div><div><br></div><div><br></div></div>