Here's a question for any C# gurus out there. I've created a delegate in C# to pass out to unmanaged C as a function pointer. It works fine, but how can I explicitly make sure it doesn't get garbage collected? I can't use any Microsoft-specific interoperability stuff because the code needs to work with Mono. In fact, it does work with Mono because Mono must do garbage collection differently than Microsoft does; my main problem is preventing Microsoft from collecting the delegate before my unmanaged code is done with it. Right now I'm continually reassigning the callback function pointer in a loop in C#, but that's not very elegant.



Email blogmasterofnoneATgmailDOTcom for text link and key word rates.

Site Info