[Mono-list] Embedded API: MonoObject equality

Rodrigo Kumpera kumpera at gmail.com
Sat Mar 22 15:04:48 UTC 2014


On Thu, Mar 20, 2014 at 6:46 PM, jonathan at mugginsoft.com <
jonathan at mugginsoft.com> wrote:

>
> On 20 Mar 2014, at 22:43, Jonathan Lima <greenboxal at gmail.com> wrote:
>
> > AFAIK MonoObject is the pointer to the object in the heap, so you just
> have to compare the pointers.
> >
> > Jonathan
> >
> I think that if the MonoObject instance isn't pinned then there is no
> guarantee that successive unmanaged pointers to a managed object will have
> the same value.
>

MonoObject pointers are what we call a raw/naked pointer. They must be
transient and never escape the C stack. You can compare them by value.

If you need a persistent pointer, use gchandled and to compare them, fetch
their values and compare those.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140322/bb6d1219/attachment.html>


More information about the Mono-list mailing list