[Mono-dev] == operator comparing COM interops
Robert Jordan
robertj at gmx.net
Thu Jul 9 11:43:08 EDT 2009
Tom Hindle wrote:
> Hi,
>
> I submitted bug https://bugzilla.novell.com/show_bug.cgi?id=520437.
>
> Basically doing:
> if (interop1 == interop2)
> {
>
> }
> where interop1 and interop2 are the same COM object (IUnknown intptr is
> the same ptr) returns false on mono and true in .NET.
>
> The only current way I can think of fixing this is by adding '==
> operator' into Object and checking for ComImport attribute and then
> checking to see if the objects are the same COM object.
Adding op_Equality to Object is not an option as it would
break the ABI and slow down all "==" operations on objects
in C#.
This must be fixed at runtime level because on MS.NET
System.__ComObjects are reference wise equal if they wrap
the same IUnknown ptr.
Robert
More information about the Mono-devel-list
mailing list