Hmm I found a way using GCHandle to fix the delegates, and using Marshal
class to do the interop...
My only concern is that if I would subscribe a lot of handlers that way, is
memory fragmentation due to all the pinning...
Regards,

Signature
Tom Tempelaere.
> Hi all,
>
[quoted text clipped - 25 lines]
> --
> Tom Tempelaere.
Marcus Heege - 21 Nov 2006 17:24 GMT
From your descriptions, I assume you are using
Marshal.GetFunctionPointerForDelegate.
In this case there is no need to fix delegates. Neither with GCHandle nor
via pinned pointers. The runtime generates a unmanaged -> managed thunk in
your case. This thunk is passed to the native function, not the delegate.
The only thing you must ensure that you hold a reference to the delegate as
long as the thunk is needed, because the lifetime of the target delegate
controls the lifetime of the thunk.
Marcus Heege
> Hmm I found a way using GCHandle to fix the delegates, and using Marshal
> class to do the interop...
[quoted text clipped - 38 lines]
>> --
>> Tom Tempelaere.