Struct FunctionPointer<T>
- Namespace
- Misaki.HighPerformance.LowLevel
- Assembly
- Misaki.HighPerformance.LowLevel.dll
A structure that encapsulates a function pointer and provides methods to convert between
public readonly struct FunctionPointer<T> where T : Delegate
Type Parameters
TThe delegate type that the function pointer represents.
- Inherited Members
Remarks
This structure used marshalling to convert between function pointers and delegates, which is not ideal for high-performance scenarios.
Use this only when necessary, and prefer using delegate* unmanaged for better performance.
Constructors
FunctionPointer(T)
Creates a new instance of this function pointer with the following native pointer.
public FunctionPointer(T func)
Parameters
funcT
Properties
Delegate
Gets the delegate instance associated with the specified function pointer.
public T Delegate { get; }
Property Value
- T
Remarks
This property uses GetDelegateForFunctionPointer<TDelegate>(nint) to convert the function
pointer to a delegate. Ensure that the function pointer is valid and compatible with the delegate type
T.
Pointer
Gets the native function pointer associated with this function pointer instance.
public nint Pointer { get; }