tgoop.com/madcsharp/8
Create:
Last Update:
Last Update:
Managed to implement calls with IL calli opcodes, both to managed and unmanaged function pointers.
This tricks could be used to manual function devirtualizing and calling managed functions without reflection and GC/boxing allocations.
FuncUnity wrapper is perfect to use within Unity because IL2CPP RuntimeMethodHandle.Value is an ACTUAL function pointer, and in Mono land this structure contains GetFunctionPointer(). This wrapper expects IL2CPP function pointer to be marked with (funcPtr | 0x80000000000000), that's beyond application address space, so we are safe here.
Of course it's possible to use FuncManaged with IL2CPP, but it could be not peak perf tho.
BY MadSharp: Unsafe

Share with your friend now:
tgoop.com/madcsharp/8