public static RedirectCallsState RedirectCalls(RuntimeMethodHandle from, RuntimeMethodHandle to) { // GetFunctionPointer enforces compilation of the method. var fptr1 = from.GetFunctionPointer(); var fptr2 = to.GetFunctionPointer(); return PatchJumpTo(fptr1, fptr2); }
public IntPtr GetFunctionPointer() { IntPtr functionPointer = RuntimeMethodHandle.GetFunctionPointer(RuntimeMethodHandle.EnsureNonNullMethodInfo(this.m_value).Value); GC.KeepAlive(this.m_value); return(functionPointer); }
/// <summary>Obtains a pointer to the method represented by this instance.</summary> /// <returns>A pointer to the method represented by this instance.</returns> /// <exception cref="T:System.Security.SecurityException">The caller does not have the necessary permission to perform this operation.</exception> /// <filterpriority>2</filterpriority> public IntPtr GetFunctionPointer() { return(RuntimeMethodHandle.GetFunctionPointer(this.value)); }