public static extern int mono_test_marshal_safearray_in_ccw([MarshalAs (UnmanagedType.Interface)] ITest itest);
[DllImport("libtest")]
+ public static extern int mono_test_marshal_lparray_out_ccw([MarshalAs (UnmanagedType.Interface)] ITest itest);
+
+ [DllImport("libtest")]
public static extern int mono_test_default_interface_ccw([MarshalAs (UnmanagedType.Interface)] ITest itest);
[DllImport("libtest")]
}
if (mono_test_marshal_safearray_in_ccw(test) != 0)
return 97;
+ if (mono_test_marshal_lparray_out_ccw(test) != 0)
+ return 98;
}
#endregion // SafeArray Tests
[MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
void ArrayIn3 (object[] array);
[MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int ArrayOut ([Out, MarshalAs (UnmanagedType.LPArray, SizeConst=1)] int[] array);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
[return: MarshalAs (UnmanagedType.Interface)]
TestDefaultInterfaceClass1 GetDefInterface1();
[MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
int ArrayIn2 ([In] object[] array);
[MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
int ArrayIn3 (object[] array);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ [PreserveSig]
+ int ArrayOut ([Out, MarshalAs (UnmanagedType.LPArray, SizeConst=1)] int[] array, out int result);
}
[System.Runtime.InteropServices.GuidAttribute ("00000000-0000-0000-0000-000000000002")]
[MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
public virtual extern void ArrayIn3 (object[] array);
[MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern int ArrayOut ([Out, MarshalAs (UnmanagedType.LPArray, SizeConst=1)] int[] array);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
public virtual extern TestDefaultInterfaceClass1 GetDefInterface1();
[MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
public virtual extern TestDefaultInterfaceClass2 GetDefInterface2();
{
return ArrayIn(array);
}
+
+ public int ArrayOut (int[] array, out int result)
+ {
+ if (array == null)
+ result = 0;
+ else
+ {
+ array[0] = 55;
+ result = 1;
+ }
+ return 0;
+ }
}
public class ManagedTest : ITest
ArrayIn(array);
}
+ public int ArrayOut (int[] array)
+ {
+ if (array == null)
+ return 0;
+ array[0] = 55;
+ return 1;
+ }
+
public TestDefaultInterfaceClass1 GetDefInterface1()
{
return new TestDefaultInterfaceClass1();
int (STDCALL *ArrayIn)(MonoComObject* pUnk, void *array);
int (STDCALL *ArrayIn2)(MonoComObject* pUnk, void *array);
int (STDCALL *ArrayIn3)(MonoComObject* pUnk, void *array);
+ int (STDCALL *ArrayOut)(MonoComObject* pUnk, guint32 *array, guint32 *result);
int (STDCALL *GetDefInterface1)(MonoComObject* pUnk, MonoDefItfObject **iface);
int (STDCALL *GetDefInterface2)(MonoComObject* pUnk, MonoDefItfObject **iface);
} MonoIUnknown;
}
LIBTEST_API int STDCALL
+ArrayOut(MonoComObject* pUnk, guint32 *array, guint32 *result)
+{
+ return S_OK;
+}
+
+LIBTEST_API int STDCALL
GetDefInterface1(MonoComObject* pUnk, MonoDefItfObject **obj)
{
return S_OK;
(*pOut)->vtbl->ArrayIn = ArrayIn;
(*pOut)->vtbl->ArrayIn2 = ArrayIn2;
(*pOut)->vtbl->ArrayIn3 = ArrayIn3;
+ (*pOut)->vtbl->ArrayOut = ArrayOut;
(*pOut)->vtbl->GetDefInterface1 = GetDefInterface1;
(*pOut)->vtbl->GetDefInterface2 = GetDefInterface2;
}
return ret;
}
+LIBTEST_API int STDCALL
+mono_test_marshal_lparray_out_ccw(MonoComObject *pUnk)
+{
+ guint32 array, result;
+ int ret;
+
+ ret = pUnk->vtbl->ArrayOut (pUnk, &array, &result);
+ if (ret)
+ return ret;
+ if (array != 55)
+ return 1;
+ if (result != 1)
+ return 2;
+
+ ret = pUnk->vtbl->ArrayOut (pUnk, NULL, &result);
+ if (ret)
+ return ret;
+ if (result != 0)
+ return 3;
+
+ return 0;
+}
+
#endif
static int call_managed_res;