case MONO_TYPE_SZARRAY:
case MONO_TYPE_CLASS:
case MONO_TYPE_VALUETYPE:
+ case MONO_TYPE_PTR:
mono_emit_marshal (m, i, invoke_sig->params [i], mspecs [i + 1], tmp_locals [i], NULL, MARSHAL_ACTION_MANAGED_CONV_OUT);
break;
default:
[DllImport(nameof(FunctionPointerNative))]
public static extern bool CheckFcnPtr(IntPtr fcnptr);
+
+ [DllImport(nameof(FunctionPointerNative))]
+ static unsafe extern void FillOutPtr(IntPtr* p);
}
delegate void VoidDelegate();
}
}
+
+ [DllImport(nameof(FunctionPointerNative))]
+ static unsafe extern void FillOutPtr(IntPtr* p);
+
+ private unsafe delegate void DelegateToFillOutPtr([Out] IntPtr* p);
+
+ public static void RunGetDelForOutPtrTest()
+ {
+ Console.WriteLine($"Running {nameof(RunGetDelForOutPtrTest)}...");
+ IntPtr outVar = 0;
+ int expectedValue = 60;
+ unsafe
+ {
+ DelegateToFillOutPtr d = new DelegateToFillOutPtr(FillOutPtr);
+ IntPtr ptr = Marshal.GetFunctionPointerForDelegate(d);
+ DelegateToFillOutPtr OutPtrDelegate = Marshal.GetDelegateForFunctionPointer<DelegateToFillOutPtr>(ptr);
+ OutPtrDelegate(&outVar);
+ }
+ Assert.Equal(expectedValue, outVar);
+ }
+
public static int Main()
{
try
{
RunGetDelForFcnPtrTest();
RunGetFcnPtrSingleMulticastTest();
+ RunGetDelForOutPtrTest();
}
catch (Exception e)
{