Re: How to write handwritten code to access the C++ object when the corresponding python object destroyed?

Weitian Leung <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <CADp56LYfOTKWBREpTcmH8ZbtjmuZtSvHEE_cH0RraPWP2oEx5Q@mail.gmail.com>
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 <[email protected]>
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
> > <[email protected]>
> > wrote:
> >
> >> I meant the C++ destructor, not __dtor__.
> >>
> >> Phil
> >>
>
>

_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.