2 using System
.Runtime
.InteropServices
;
4 [StructLayout(LayoutKind
.Sequential
)]
10 [StructLayout(LayoutKind
.Explicit
)]
13 [FieldOffset(0)] public int i1
;
14 [FieldOffset(0)] public int i2
;
17 [StructLayout(LayoutKind
.Sequential
)]
25 /* various small structs for testing struct-by-value where they are handled specially
28 [StructLayout(LayoutKind
.Sequential
)]
34 [StructLayout(LayoutKind
.Sequential
)]
42 [StructLayout(LayoutKind
.Sequential
)]
58 public struct NestedFloat
{
65 [DllImport ("libtest")]
66 public static extern int mono_union_test_1 (cs a
);
68 [DllImport ("libtest")]
69 public static extern int mono_return_int (int a
);
71 [DllImport ("libtest", EntryPoint
="mono_return_int_ss")]
72 public static extern int mono_return_int_ss (ss a
);
74 [DllImport ("libtest", EntryPoint
="mono_return_ss")]
75 public static extern ss
mono_return_ss (ss a
);
77 [DllImport ("libtest", EntryPoint
="mono_return_sc1")]
78 public static extern sc1
mono_return_sc1 (sc1 a
);
80 [DllImport ("libtest", EntryPoint
="mono_return_sc3")]
81 public static extern sc3
mono_return_sc3 (sc3 a
);
83 [DllImport ("libtest", EntryPoint
="mono_return_sc5")]
84 public static extern sc5
mono_return_sc5 (sc5 a
);
86 [DllImport ("libtest", EntryPoint
="mono_return_int_su")]
87 public static extern int mono_return_int_su (su a
);
89 [DllImport ("libtest", EntryPoint
="mono_return_nested_float")]
90 public static extern NestedFloat
mono_return_nested_float ();
94 if (mono_return_int (5) != 5)
99 if (mono_return_int_ss (s1
) != 4)
102 s1
= mono_return_ss (s1
);
109 if (mono_return_int_su (s2
) != 3)
113 if (mono_return_int_su (s2
) != 2)
123 if (mono_union_test_1 (s3
) != 13)
127 if (mono_union_test_1 (s3
) != 14)
131 if (mono_union_test_1 (s3
) != 15)
136 s4
= mono_return_sc1(s4
);
144 s5
= mono_return_sc3(s5
);
145 if (s5
.c0
!= 5 || s5
.c1
!= 7 || s5
.c2
!= 9)
154 s6
= mono_return_sc5(s6
);
155 if (s6
.c0
!= 5 || s6
.c1
!= 7 || s6
.c2
!= 9 || s6
.c3
!= 11 || s6
.c4
!= 13)
158 var f
= mono_return_nested_float ();