2004-06-10 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mono / tests / pinvoke.cs
index 68d4ea6a6c79880bea1f2ae84e9b4eadd8f9edb7..9421377621d4a16fb706011c0d78626dbab50366 100755 (executable)
@@ -6,25 +6,31 @@ public class Test {
        [DllImport("cygwin1.dll", EntryPoint="puts", CharSet=CharSet.Ansi)]
        public static extern int puts (string name);
 
-       [DllImport ("libtest.so", EntryPoint="mono_test_many_int_arguments")]
+       [DllImport ("libtest", EntryPoint="mono_test_many_int_arguments")]
        public static extern int mono_test_many_int_arguments (int a, int b, int c, int d, int e,
                                                               int f, int g, int h, int i, int j);
-       [DllImport ("libtest.so", EntryPoint="mono_test_many_short_arguments")]
+       [DllImport ("libtest", EntryPoint="mono_test_many_short_arguments")]
        public static extern int mono_test_many_short_arguments (short a, short b, short c, short d, short e,
                                                                 short f, short g, short h, short i, short j);
-       [DllImport ("libtest.so", EntryPoint="mono_test_many_byte_arguments")]
+       [DllImport ("libtest", EntryPoint="mono_test_many_byte_arguments")]
        public static extern int mono_test_many_byte_arguments (byte a, byte b, byte c, byte d, byte e,
                                                                byte f, byte g, byte h, byte i, byte j);
-       [DllImport ("libtest.so", EntryPoint="mono_test_many_float_arguments")]
+       [DllImport ("libtest", EntryPoint="mono_test_many_float_arguments")]
        public static extern float mono_test_many_float_arguments (float a, float b, float c, float d, float e,
                                                                float f, float g, float h, float i, float j);
-       [DllImport ("libtest.so", EntryPoint="mono_test_many_double_arguments")]
+       [DllImport ("libtest", EntryPoint="mono_test_many_double_arguments")]
        public static extern double mono_test_many_double_arguments (double a, double b, double c, double d, double e,
                                                                double f, double g, double h, double i, double j);
+       [DllImport ("libtest", EntryPoint="mono_test_split_double_arguments")]
+       public static extern double mono_test_split_double_arguments (double a, double b, float c, double d, double e);
 
        public static int Main () {
-               puts ("A simple Test for PInvoke");
-               
+               try {
+                       puts ("A simple Test for PInvoke");
+               }
+               catch (DllNotFoundException) {
+               }
+
                if (Math.Cos (Math.PI) != -1)
                        return 1;
                if (Math.Acos (1) != 0)
@@ -39,6 +45,10 @@ public class Test {
                        return 6;
                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)
                        return 7;
+
+               /* Test Sparc V8 split register/stack double parameter passing */
+               if (mono_test_split_double_arguments (1.0, 2.0, 3.0f, 4.0, 5.0) != 15.0)
+                       return 8;
                
                return 0;
        }