[Kde-bindings] Qyoto: SIGNALS/SLOTS

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Dec 15 20:59:40 UTC 2005


On Thursday 15 December 2005 13:32, Arno Rehn wrote:
> Am Mittwoch, 14. Dezember 2005 20:22 schrieb Adam Treat:
> > On Wednesday December 14 2005 1:43 pm, you wrote:
> > > Hi,
> > >
> > > I found the following in you code:
> > > IntPtr s = (this.Instance as QtSharp).RawObject;
> > >
> > > does 'RawObject' point to the underlying C++ instance?
> > > If it does, a second question: How do I get the pointer to the
> > > C++-instance? It tried it with 'GCHandle.Alloc' but that doesn't seem
> > > to work.
> >
> > Yes, it does.  You can find the code for RawObject and the handling of
> > C++ pointer interaction in the attached file.
I'm not sure if it's a good idea to wrap a C++ IntPtr (RawObject) as a 
GCHandle, I don't think that's what it's for. A C++ instance should really be 
a 'void *' on the C/C++ side, and an IntPtr in C#. While a C# instance should 
be passed as a GCHandle from C# to the C/C++ side, and be a 'void *' there. 
Which is confusing, but when I typedef'd 'void *' as 'GCHandle' in C trying 
to make things clearer it messed up the marshalling.

-- Richard



More information about the Kde-bindings mailing list