Method GetLdftnPointer
GetLdftnPointer(MethodBase)
Get a native function pointer for a given method. This matches an IL-level ldftn.
public static nint GetLdftnPointer(this MethodBase m)
Parameters
m
MethodBase- The method to get a native function pointer for.
Returns
- nint
- The native function pointer.
Remarks
The result of ldftn doesn't always match that of MethodHandle.GetFunctionPointer().
For example, ldftn doesn't JIT-compile the method on mono, which thus keeps the class constructor untouched.
And on .NET, struct overrides (f.e. ToString) have got multiple entry points pointing towards the same code.