Method AddInteropCallback
AddInteropCallback<T>(String, T)
Adds or replaces an interop callback for a global symbol
Declaration
public void AddInteropCallback<T>(string symbolName, T delegate)
where T : Delegate
Parameters
public void AddInteropCallback<T>(string symbolName, T delegate)
where T : Delegate
String | symbolName | Symbol name of the global |
T | delegate | Delegate for the callback |
Type Parameters
T | Delegate type for the callback |
Remarks
warning
The delegate is made available to native code as a callback, and therefore it must have a lifetime that is at least as long as the callback is registered or the lifetime of the JIT engine itself. The direct delegate and any instance it may be a member of are handled automatically in the internal implementation of this function. However, any data the delegate may rely on is not. (e.g. if the object the delegate is a method on a class implementing IDisposable and the Dispose method was called on that instance, then the callback could end up operating on a disposed object)
warning
The callback MUST NOT throw any exceptions out of the callback, as the JIT engine doesn't know how to handle them and neither does the JIT'd code.