Managed callback to native code (reverse p/invoke)
If I pass a managed callback to native code, do I need to pin the stored delegate so it does not get moved to a new memory address or is this handled by the runtime?
4 Replies
all you need to do is make it static i think
Yeah I could, but I'm curious specifically about the semantics of an instanced callback.
For example, I could have an unmanaged and managed representation of a class and have an instance id to track it between creation and disposal on the native side
then ig u have to pin it, not really sure tho
Yeah that's what I'm thinking too, but wanted to get confirmation