case MONO_TYPE_CLASS:
case MONO_TYPE_VALUETYPE:
case MONO_TYPE_PTR:
+ case MONO_TYPE_I:
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))]
static unsafe extern void FillOutPtr(IntPtr* p);
+
+ [DllImport(nameof(FunctionPointerNative))]
+ static unsafe extern void FillOutIntParameter(out IntPtr p);
}
delegate void VoidDelegate();
Assert.Equal(expectedValue, outVar);
}
+ [DllImport(nameof(FunctionPointerNative))]
+ static unsafe extern void FillOutIntParameter(out IntPtr p);
+
+ private unsafe delegate void DelegateToFillOutIntParameter(out IntPtr p);
+
+ public static void RunGetDelForOutIntTest()
+ {
+ Console.WriteLine($"Running {nameof(RunGetDelForOutIntTest)}...");
+ IntPtr outVar = 0;
+ int expectedValue = 50;
+ unsafe
+ {
+ DelegateToFillOutIntParameter d = new DelegateToFillOutIntParameter(FillOutIntParameter);
+ IntPtr ptr = Marshal.GetFunctionPointerForDelegate(d);
+ DelegateToFillOutIntParameter OutPtrDelegate = Marshal.GetDelegateForFunctionPointer<DelegateToFillOutIntParameter>(ptr);
+ OutPtrDelegate(out outVar);
+ GC.KeepAlive(d);
+ }
+ Assert.Equal(expectedValue, outVar);
+ }
+
public static int Main()
{
try
RunGetDelForFcnPtrTest();
RunGetFcnPtrSingleMulticastTest();
RunGetDelForOutPtrTest();
+ RunGetDelForOutIntTest();
}
catch (Exception e)
{