2 using System
.Reflection
;
3 using System
.Runtime
.InteropServices
;
4 using System
.Runtime
.CompilerServices
;
9 [DllImport("foo.dll", CallingConvention
=CallingConvention
.Winapi
)]
10 public static extern void pf1(string format
, __arglist
);
12 [DllImport("foo.dll", CallingConvention
=CallingConvention
.Cdecl
)]
13 public static extern void pf2(string format
, __arglist
);
15 [DllImport("foo.dll", CallingConvention
=CallingConvention
.StdCall
)]
16 public static extern void pf3(string format
, __arglist
);
18 [DllImport("foo.dll", CallingConvention
=CallingConvention
.ThisCall
)]
19 public static extern void pf4(string format
, __arglist
);
21 [DllImport("foo.dll", CallingConvention
=CallingConvention
.FastCall
)]
22 public static extern void pf5(string format
, __arglist
);
24 [DllImport("foo.dll", CallingConvention
=CallingConvention
.StdCall
)]
25 public static extern void mixed1(string format
);
29 for (int i
= 1; i
< 6; ++i
) {
30 if (typeof (Program
).GetMethod ("pf"+i
).CallingConvention
!= CallingConventions
.VarArgs
) {
31 Console
.WriteLine ("pf{0} {1} != VarArg", i
, typeof (Program
).GetMethod ("pf"+i
).CallingConvention
);
36 if (typeof (Program
).GetMethod ("mixed1").CallingConvention
!= CallingConventions
.Standard
) {
37 Console
.WriteLine ("mixed1 {0} != Standard", typeof (Program
).GetMethod ("mixed1").CallingConvention
);
41 Console
.WriteLine ("OK");