"UnmanagedCallersOnly Example, C# Side"

[DllImport("NativeLib.dll", CallingConvention = CallingConvention.Cdecl)]
public static unsafe extern void InvokeFuncPtr(delegate* unmanaged[Cdecl]<int> funcPtr);

[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
public static int ReturnInt() => 123;


Code snippet taken from "Complete C# Quick Reference - C# 9".