[PyQt] How to write handwritten code to access the C++ object when the corresponding python object destroyed?

Weitian Leung weitianleung at gmail.com
Thu Feb 20 13:41:16 GMT 2020


If you mean write the %MethodCode handwritten code to deal all the methods
that contains the BSTR, it's the orignal resolution that I thought before...

I should now start writing the script to do all the works. LoL

Thanks.

On Thu, Feb 20, 2020 at 8:59 PM Phil Thompson <phil at riverbankcomputing.com>
wrote:

> Read the %MethodCode documentation.
>
> On 20/02/2020 12:49, Weitian Leung wrote:
> > Did you mean the wrapped class destructor? It's not the case I want...
> >
> > struct IDemo
> >> {
> >>     virtual void do_sth(BSTR bstr) = 0;
> >> };
> >>
> >
> > The IDemo is created by other C++ interface, the correct way to pass
> > the
> > bstr to *do_sth *is call *SysAllocString*,
> > and after the call returned, we need call *SysFreeString* to free the
> > bstr.
> > Because the IDemo instance will not take over the ownership of the
> > bstr.
> >
> > So when mapped the BSTR to str, it seems that we don't have any chance
> > to
> > call the *SysFreeString *to free the str that allocated inside
> > *%ConvertToTypeCode.*
> >
> >
> >
> > On Thu, Feb 20, 2020 at 5:07 PM Phil Thompson
> > <phil at riverbankcomputing.com>
> > wrote:
> >
> >> I meant the C++ destructor, not __dtor__.
> >>
> >> Phil
> >>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200220/12c0c8f8/attachment.html>


More information about the PyQt mailing list