[Mono-list] calling a delegate from unmanaged code to managed code

GaoXianchao gxcmaillist at gmail.com
Mon Apr 10 01:44:43 EDT 2006


2006/4/10, Gonzalo Paniagua Javier <gonzalo at ximian.com>:
> On Mon, 2006-04-10 at 13:11 +0800, GaoXianchao wrote:
> > hi all,
> >
> > I want to call a delegate from unmanaged code to managed code.
> > For some reson, I can't pass the delegate to unmanaged code every
> > time.So, I remember the delegate in the unmanaged code.
> >
> > But, the garbage collector will move the delegate object in memory,
> > how can i avoid this?
>
> Keep a copy of the delegate in a managed code (arraylist, field...).
>

Thanks a lot:)

Can this prevents the garbage collector from *moving* the delegate
object in memory?

Or this only prevents the garbage collector from *reclaiming* the
delegate object.


More information about the Mono-list mailing list