2 using System.Runtime.InteropServices;
6 [DllImport("cygwin1.dll", EntryPoint="puts", CharSet=CharSet.Ansi)]
7 public static extern int puts (string name);
9 [DllImport ("libtest", EntryPoint="mono_test_many_int_arguments")]
10 public static extern int mono_test_many_int_arguments (int a, int b, int c, int d, int e,
11 int f, int g, int h, int i, int j);
12 [DllImport ("libtest", EntryPoint="mono_test_many_short_arguments")]
13 public static extern int mono_test_many_short_arguments (short a, short b, short c, short d, short e,
14 short f, short g, short h, short i, short j);
15 [DllImport ("libtest", EntryPoint="mono_test_many_byte_arguments")]
16 public static extern int mono_test_many_byte_arguments (byte a, byte b, byte c, byte d, byte e,
17 byte f, byte g, byte h, byte i, byte j);
18 [DllImport ("libtest", EntryPoint="mono_test_many_float_arguments")]
19 public static extern float mono_test_many_float_arguments (float a, float b, float c, float d, float e,
20 float f, float g, float h, float i, float j);
21 [DllImport ("libtest", EntryPoint="mono_test_many_double_arguments")]
22 public static extern double mono_test_many_double_arguments (double a, double b, double c, double d, double e,
23 double f, double g, double h, double i, double j);
24 [DllImport ("libtest", EntryPoint="mono_test_split_double_arguments")]
25 public static extern double mono_test_split_double_arguments (double a, double b, float c, double d, double e);
27 public static int Main () {
29 puts ("A simple Test for PInvoke");
31 catch (DllNotFoundException) {
34 if (Math.Cos (Math.PI) != -1)
36 if (Math.Acos (1) != 0)
38 if (mono_test_many_int_arguments (1, 1, 1, 1, 1, 1, 1, 1, 1, 1) != 10)
40 if (mono_test_many_short_arguments (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) != 55)
42 if (mono_test_many_byte_arguments (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) != 55)
44 if (mono_test_many_float_arguments (1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f) != 55.0f)
46 if (mono_test_many_double_arguments (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0) != 55.0)
49 /* Test Sparc V8 split register/stack double parameter passing */
50 if (mono_test_split_double_arguments (1.0, 2.0, 3.0f, 4.0, 5.0) != 15.0)