[Mono-dev] Embedded: storing extra data on objects?

David Mitchell dmitchell at logos.com
Mon Mar 30 22:11:18 EDT 2009


I need to interact with classes in third party libraries, so fields  
are out--unless there's a way to modify classes as they're loaded...

--Dave (on the iPhone)

On Mar 30, 2009, at 7:02 PM, "BGB" <cr88192 at hotmail.com> wrote:

>
> ----- Original Message -----
> From: David Mitchell
> To: mono-devel-list at lists.ximian.com
> Sent: Tuesday, March 31, 2009 2:49 AM
> Subject: [Mono-dev] Embedded: storing extra data on objects?
>
> When embedding mono, is there a way to store a little bit of extra  
> information (pointer-sized) along with a MonoObject (or similar  
> structure)?
>
> My scenario is that I have unmanaged wrappers for managed objects,  
> and I’d like to ensure that there is never more than one unmanaged w 
> rapper per object (and also be able to get the unmanaged wrapper if  
> all I have is the object). I’m sure I know that I could use a hash t 
> able for this,    and that may end up being what I do, but actually  
> storing the pointer on the MonoObject seems more natural, in my case.
>
> A related question: if this isn’t possible, would a patch to facilit 
> ate scenarios like mine be welcomed, or is it something that the com 
> munity is thoroughly disinterested in?
>
> --Dave
>
> beyond a hash table, have you also considered whether it would make  
> sense to put the pointer in an ordinary field (or slot/member/...),  
> and then retrieve the value from the field as needed?...
>
> (sorry, I am no expert on mono's internals, so I don't know how  
> reasonable this is either...).
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090330/1a3d6cf8/attachment-0001.html 


More information about the Mono-devel-list mailing list