I’m working on embedding mono into an application I’m creating, and I haven’t gotten super far, but one of the things I can’t seem to find is how to tell mono when I’m using an object and done with an object.
I want to keep a reference to a C# object to call methods on until the lifetime of it’s parallel object in C++ is over, at which point, I want to tell mono that the C# object is safe to collect.
How is this accomplished?
It appears that what I’m looking for is mono_gchandle_new, and hold onto the handle, not the MonoObject*, and use mono_gchandle_get_target when I need it.
mono_gchandle_new allows you to pin when creating the handle, but is it possible to pin after the fact?