Embedded API: monoObject keying

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Embedded API: monoObject keying

Jonathan Mitchell

I wrap monoObject instances in a corresponding Objective-C instance.
In general I want to maintain a a 1 to 1 relationship between any given managed object and its unmanaged Obj-C representation.

I use mono_gchandle_new() and mono_gchandle_get_target() to access the unpinned managed objects.

When a receive a monoObject in my unmanaged code, as the sender say of an event, I iterate over a global collection of all my obj-C representations calling mono_gchandle_get_target for each in order to check for monoObject equality.

Is this the best I can do?

I could use gchandle as a hash key but as far as I can tell there is no function that associates a given monoObject * with one or more gchandles.

Thanks

Jonathan














_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: Embedded API: monoObject keying

Wayne Douglas
I have a public docker container with a more up to date v of mono on. Search wayneo/mono

Hth

Sent from Mailbox


On Tue, Aug 26, 2014 at 12:05 PM, Jonathan Mitchell <[hidden email]> wrote:


I wrap monoObject instances in a corresponding Objective-C instance.
In general I want to maintain a a 1 to 1 relationship between any given managed object and its unmanaged Obj-C representation.

I use mono_gchandle_new() and mono_gchandle_get_target() to access the unpinned managed objects.

When a receive a monoObject in my unmanaged code, as the sender say of an event, I iterate over a global collection of all my obj-C representations calling mono_gchandle_get_target for each in order to check for monoObject equality.

Is this the best I can do?

I could use gchandle as a hash key but as far as I can tell there is no function that associates a given monoObject * with one or more gchandles.

Thanks

Jonathan














_______________________________________________
Mono-list maillist - [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list


_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: Embedded API: monoObject keying

Rodrigo Kumpera
In reply to this post by Jonathan Mitchell
You can implement use a hashtable keyed on MonoObject with mono_object_hash and direct equality.



On Tue, Aug 26, 2014 at 6:58 AM, Jonathan Mitchell <[hidden email]> wrote:

I wrap monoObject instances in a corresponding Objective-C instance.
In general I want to maintain a a 1 to 1 relationship between any given managed object and its unmanaged Obj-C representation.

I use mono_gchandle_new() and mono_gchandle_get_target() to access the unpinned managed objects.

When a receive a monoObject in my unmanaged code, as the sender say of an event, I iterate over a global collection of all my obj-C representations calling mono_gchandle_get_target for each in order to check for monoObject equality.

Is this the best I can do?

I could use gchandle as a hash key but as far as I can tell there is no function that associates a given monoObject * with one or more gchandles.

Thanks

Jonathan














_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list


_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list