+ [PreserveSig ()]
+ int FloatIn (float val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ [PreserveSig ()]
+ int DoubleIn (double val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ [PreserveSig ()]
+ int ITestIn ([MarshalAs (UnmanagedType.Interface)]ITestPresSig val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ [PreserveSig ()]
+ int ITestOut ([MarshalAs (UnmanagedType.Interface)]out ITestPresSig val);
+ }
+
+ [System.Runtime.InteropServices.GuidAttribute ("00000000-0000-0000-0000-000000000002")]
+ [System.Runtime.InteropServices.ComImportAttribute ()]
+ [System.Runtime.InteropServices.ClassInterfaceAttribute (ClassInterfaceType.None)]
+ public class _TestClass : ITest
+ {
+ // properties need to go first since mcs puts them there
+ public virtual extern ITest Test
+ {
+ [return: MarshalAs (UnmanagedType.Interface)]
+ [MethodImpl (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId (5242884)]
+ get;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SByteIn (sbyte val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void ByteIn (byte val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void ShortIn (short val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void UShortIn (ushort val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void IntIn (int val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void UIntIn (uint val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void LongIn (long val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void ULongIn (ulong val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void FloatIn (float val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void DoubleIn (double val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void ITestIn ([MarshalAs (UnmanagedType.Interface)]ITest val);
+ [MethodImplAttribute (MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void ITestOut ([MarshalAs (UnmanagedType.Interface)]out ITest val);
+ }
+
+ [System.Runtime.InteropServices.GuidAttribute ("00000000-0000-0000-0000-000000000002")]
+ public class TestClass : _TestClass
+ {
+ static TestClass ()
+ {
+ ExtensibleClassFactory.RegisterObjectCreationCallback (new ObjectCreationDelegate (CreateObject)); ;
+ }
+ private static System.IntPtr CreateObject (System.IntPtr aggr)
+ {
+ IntPtr pUnk3;
+ mono_test_marshal_com_object_create (out pUnk3);
+ return pUnk3;
+ }
+ }
+
+
+ delegate void SByteInDelegate (sbyte val);
+ delegate void ByteInDelegate (byte val);
+ delegate void ShortInDelegate (short val);
+ delegate void UShortInDelegate (ushort val);
+ delegate void IntInDelegate (int val);
+ delegate void UIntInDelegate (uint val);
+ delegate void LongInDelegate (long val);
+ delegate void ULongInDelegate (ulong val);
+ delegate void FloatInDelegate (float val);
+ delegate void DoubleInDelegate (double val);
+ delegate void ITestInDelegate (ITest val);
+ delegate void ITestOutDelegate (out ITest val);
+
+ public class ManagedTestPresSig : ITestPresSig
+ { // properties need to go first since mcs puts them there
+ public ITestPresSig Test
+ {
+ get
+ {
+ return new ManagedTestPresSig ();
+ }
+ }
+
+ public int SByteIn (sbyte val)
+ {
+ if (val != -100)
+ return 1;
+ return 0;
+ }
+
+ public int ByteIn (byte val)
+ {
+ if (val != 100)
+ return 2;
+ return 0;
+ }
+
+ public int ShortIn (short val)
+ {
+ if (val != -100)
+ return 3;
+ return 0;
+ }
+
+ public int UShortIn (ushort val)
+ {
+ if (val != 100)
+ return 4;
+ return 0;
+ }
+
+ public int IntIn (int val)
+ {
+ if (val != -100)
+ return 5;
+ return 0;
+ }
+
+ public int UIntIn (uint val)
+ {
+ if (val != 100)
+ return 6;
+ return 0;
+ }
+
+ public int LongIn (long val)
+ {
+ if (val != -100)
+ return 7;
+ return 0;
+ }
+
+ public int ULongIn (ulong val)
+ {
+ if (val != 100)
+ return 8;
+ return 0;
+ }
+
+ public int FloatIn (float val)
+ {
+ if (Math.Abs (val - 3.14f) > .000001)
+ return 9;
+ return 0;
+ }
+
+ public int DoubleIn (double val)
+ {
+ if (Math.Abs (val - 3.14f) > .000001)
+ return 10;
+ return 0;
+ }
+
+ public int ITestIn ([MarshalAs (UnmanagedType.Interface)]ITestPresSig val)
+ {
+ if (val == null)
+ return 11;
+ if (null == val as ManagedTestPresSig)
+ return 12;
+ return 0;
+ }
+
+ public int ITestOut ([MarshalAs (UnmanagedType.Interface)]out ITestPresSig val)
+ {
+ val = new ManagedTestPresSig ();
+ return 0;
+ }
+ }
+
+ public class ManagedTest : ITest
+ {
+ private int status = 0;
+ public int Status
+ {
+ get { return status; }
+ }
+ public void SByteIn (sbyte val)
+ {
+ if (val != -100)
+ status = 1;
+ }
+
+ public void ByteIn (byte val)
+ {
+ if (val != 100)
+ status = 2;
+ }
+
+ public void ShortIn (short val)
+ {
+ if (val != -100)
+ status = 3;
+ }
+
+ public void UShortIn (ushort val)
+ {
+ if (val != 100)
+ status = 4;
+ }
+
+ public void IntIn (int val)
+ {
+ if (val != -100)
+ status = 5;
+ }
+
+ public void UIntIn (uint val)
+ {
+ if (val != 100)
+ status = 6;
+ }
+
+ public void LongIn (long val)
+ {
+ if (val != -100)
+ status = 7;
+ }
+
+ public void ULongIn (ulong val)
+ {
+ if (val != 100)
+ status = 8;
+ }
+
+ public void FloatIn (float val)
+ {
+ if (Math.Abs (val - 3.14f) > .000001)
+ status = 9;
+ }
+
+ public void DoubleIn (double val)
+ {
+ if (Math.Abs (val - 3.14) > .000001)
+ status = 10;
+ }
+
+ public void ITestIn (ITest val)
+ {
+ if (val == null)
+ status = 11;
+ if (null == val as ManagedTest)
+ status = 12;
+ }
+
+ public void ITestOut (out ITest val)
+ {
+ val = new ManagedTest ();
+ }
+
+ public ITest Test
+ {
+ get
+ {
+ return new ManagedTest ();
+ }
+ }
+ }
+
+ public static int mono_test_marshal_variant_in_callback (VarEnum vt, object obj)
+ {
+ switch (vt)
+ {
+ case VarEnum.VT_I1:
+ if (obj.GetType () != typeof (sbyte))
+ return 1;
+ if ((sbyte)obj != -100)
+ return 2;
+ break;
+ case VarEnum.VT_UI1:
+ if (obj.GetType () != typeof (byte))
+ return 1;
+ if ((byte)obj != 100)
+ return 2;
+ break;
+ case VarEnum.VT_I2:
+ if (obj.GetType () != typeof (short))
+ return 1;
+ if ((short)obj != -100)
+ return 2;
+ break;
+ case VarEnum.VT_UI2:
+ if (obj.GetType () != typeof (ushort))
+ return 1;
+ if ((ushort)obj != 100)
+ return 2;
+ break;
+ case VarEnum.VT_I4:
+ if (obj.GetType () != typeof (int))
+ return 1;
+ if ((int)obj != -100)
+ return 2;
+ break;
+ case VarEnum.VT_UI4:
+ if (obj.GetType () != typeof (uint))
+ return 1;
+ if ((uint)obj != 100)
+ return 2;
+ break;
+ case VarEnum.VT_I8:
+ if (obj.GetType () != typeof (long))
+ return 1;
+ if ((long)obj != -100)
+ return 2;
+ break;
+ case VarEnum.VT_UI8:
+ if (obj.GetType () != typeof (ulong))
+ return 1;
+ if ((ulong)obj != 100)
+ return 2;
+ break;
+ case VarEnum.VT_R4:
+ if (obj.GetType () != typeof (float))
+ return 1;
+ if (Math.Abs ((float)obj - 3.14f) > 1e-10)
+ return 2;
+ break;
+ case VarEnum.VT_R8:
+ if (obj.GetType () != typeof (double))
+ return 1;
+ if (Math.Abs ((double)obj - 3.14) > 1e-10)
+ return 2;
+ break;
+ case VarEnum.VT_BSTR:
+ if (obj.GetType () != typeof (string))
+ return 1;
+ if ((string)obj != "PI")
+ return 2;
+ break;
+ case VarEnum.VT_BOOL:
+ if (obj.GetType () != typeof (bool))
+ return 1;
+ if ((bool)obj != true)
+ return 2;
+ break;
+ }
+ return 0;
+ }
+
+ public static int mono_test_marshal_variant_out_callback (VarEnum vt, ref object obj)
+ {
+ switch (vt) {
+ case VarEnum.VT_I1:
+ obj = (sbyte)-100;
+ break;
+ case VarEnum.VT_UI1:
+ obj = (byte)100;
+ break;
+ case VarEnum.VT_I2:
+ obj = (short)-100;
+ break;
+ case VarEnum.VT_UI2:
+ obj = (ushort)100;
+ break;
+ case VarEnum.VT_I4:
+ obj = (int)-100;
+ break;
+ case VarEnum.VT_UI4:
+ obj = (uint)100;
+ break;
+ case VarEnum.VT_I8:
+ obj = (long)-100;
+ break;
+ case VarEnum.VT_UI8:
+ obj = (ulong)100;
+ break;
+ case VarEnum.VT_R4:
+ obj = (float)3.14f;
+ break;
+ case VarEnum.VT_R8:
+ obj = (double)3.14;
+ break;
+ case VarEnum.VT_BSTR:
+ obj = "PI";
+ break;
+ case VarEnum.VT_BOOL:
+ obj = true;
+ break;
+ }
+ return 0;
+ }
+
+ public static int TestITest (ITest itest)
+ {
+ try {
+ ITest itest2;
+ itest.SByteIn (-100);
+ itest.ByteIn (100);
+ itest.ShortIn (-100);
+ itest.UShortIn (100);
+ itest.IntIn (-100);
+ itest.UIntIn (100);
+ itest.LongIn (-100);
+ itest.ULongIn (100);
+ itest.FloatIn (3.14f);
+ itest.DoubleIn (3.14);
+ itest.ITestIn (itest);
+ itest.ITestOut (out itest2);
+ }
+ catch (Exception ex) {
+ return 1;
+ }
+ return 0;
+ }
+
+ public static int TestITestPresSig (ITestPresSig itest)
+ {
+ ITestPresSig itest2;
+ if (itest.SByteIn (-100) != 0)
+ return 1000;
+ if (itest.ByteIn (100) != 0)
+ return 1001;
+ if (itest.ShortIn (-100) != 0)
+ return 1002;
+ if (itest.UShortIn (100) != 0)
+ return 1003;
+ if (itest.IntIn (-100) != 0)
+ return 1004;
+ if (itest.UIntIn (100) != 0)
+ return 1005;
+ if (itest.LongIn (-100) != 0)
+ return 1006;
+ if (itest.ULongIn (100) != 0)
+ return 1007;
+ if (itest.FloatIn (3.14f) != 0)
+ return 1008;
+ if (itest.DoubleIn (3.14) != 0)
+ return 1009;
+ if (itest.ITestIn (itest) != 0)
+ return 1010;
+ if (itest.ITestOut (out itest2) != 0)
+ return 1011;
+ return 0;
+ }
+
+ public static int TestITestDelegate (ITest itest)
+ {
+ try {
+ ITest itest2;
+
+ SByteInDelegate SByteInFcn= itest.SByteIn;
+ ByteInDelegate ByteInFcn = itest.ByteIn;
+ UShortInDelegate UShortInFcn = itest.UShortIn;
+ IntInDelegate IntInFcn = itest.IntIn;
+ UIntInDelegate UIntInFcn = itest.UIntIn;
+ LongInDelegate LongInFcn = itest.LongIn;
+
+ ULongInDelegate ULongInFcn = itest.ULongIn;
+ FloatInDelegate FloatInFcn = itest.FloatIn;
+ DoubleInDelegate DoubleInFcn = itest.DoubleIn;
+ ITestInDelegate ITestInFcn = itest.ITestIn;
+ ITestOutDelegate ITestOutFcn = itest.ITestOut;
+
+ SByteInFcn (-100);
+ ByteInFcn (100);
+ UShortInFcn (100);
+ IntInFcn (-100);
+ UIntInFcn (100);
+ LongInFcn (-100);
+ ULongInFcn (100);
+ FloatInFcn (3.14f);
+ DoubleInFcn (3.14);
+ ITestInFcn (itest);
+ ITestOutFcn (out itest2);
+ }
+ catch (Exception) {
+ return 1;
+ }
+ return 0;