[jit] In native-to-managed wrappers, emit the initlocals code for vtypes after the...
[mono.git] / mono / tests / pinvoke3.cs
index 8d5cfb619f0657d5ab751afc0f509ba163b296f9..c1354ce9b544dc34baea80b26e75b16fa20e156b 100644 (file)
@@ -746,6 +746,21 @@ public class Tests {
                return mono_test_marshal_array_delegate1 (null, 0, new ArrayDelegate1 (array_delegate2));
        }
 
+       public delegate int ArrayDelegateBlittable (int i, string j,
+                                                                               [In, MarshalAs(UnmanagedType.LPArray,
+                                                                                                          ArraySubType=UnmanagedType.LPStr, SizeParamIndex=0)] int[] arr);
+
+       [DllImport ("libtest", EntryPoint="mono_test_marshal_array_delegate")]
+       public static extern int mono_test_marshal_array_delegate1 (string[] arr, int len, ArrayDelegateBlittable d);
+
+       public static int array_delegate_null_blittable (int i, string j, int[] arr) {
+               return (arr == null) ? 0 : 1;
+       }
+
+       public static int test_0_marshal_array_delegate_null_blittable () {
+               return mono_test_marshal_array_delegate1 (null, 0, new ArrayDelegateBlittable (array_delegate_null_blittable));
+       }
+
        public delegate int ArrayDelegate3 (int i, 
                                                                                string j, 
                                                                                [In, MarshalAs(UnmanagedType.LPArray, 
@@ -1105,6 +1120,44 @@ public class Tests {
                return res;
        }
 
+       public struct LargeStruct {
+            public Int16 s;
+            public Int16 v;
+            public UInt32 p;
+            public UInt32 e;
+            public Int32 l;
+            public Int32 ll;
+            public UInt16 h;
+            public Int16 r;
+            public Int16 pp;
+            public Int32 hh;
+            public Int32 bn;
+            public Int32 dn;
+            public Int32 dr;
+            public Int32 sh;
+            public Int32 ra;
+            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
+            public Int32[] angle;
+            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
+            public Int32[] width;
+            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
+            public Int32[] edge;
+            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3 * 1024)]
+            public byte[] echo;
+       }
+
+       public delegate int LargeStructDelegate (ref LargeStruct s);
+
+       [DllImport ("libtest", EntryPoint="mono_test_marshal_thread_attach_large_vt")]
+       public static extern int mono_test_marshal_thread_attach_large_vt (LargeStructDelegate d);
+
+       public static int test_43_thread_attach_large_vt () {
+               int res = mono_test_marshal_thread_attach_large_vt (delegate (ref LargeStruct s) {
+                               return 43;
+                       });
+               return res;
+       }
+
        class Worker {
                volatile bool stop = false;
                public void Stop () {