2007-06-22 Rodrigo Kumpera <kumpera@gmail.com>
[mono.git] / mono / tests / pinvoke3.cs
index e706bbafce69f92d643c07a4ed3a21585c407afb..c9821b1704fbb0e79e9b802bf9d029eae322079c 100644 (file)
@@ -848,6 +848,31 @@ public class Tests {
                return mono_test_marshal_out_string_array_delegate (arr, 2, new ArrayDelegate10 (array_delegate10));
        }
 
+       /*
+        * [In, Out] classes
+        */
+
+       public delegate int InOutByvalClassDelegate ([In, Out] SimpleClass ss);
+
+       [DllImport ("libtest", EntryPoint="mono_test_marshal_inout_byval_class_delegate")]
+       public static extern int mono_test_marshal_inout_byval_class_delegate (InOutByvalClassDelegate d);
+
+       public static int delegate_test_byval_class_inout (SimpleClass ss) {
+               if ((ss.a != false) || (ss.b != true) || (ss.c != false) || (ss.d != "FOO"))
+                       return 1;
+
+               ss.a = true;
+               ss.b = false;
+               ss.c = true;
+               ss.d = "RES";
+
+               return 0;
+       }
+
+       public static int test_0_marshal_inout_byval_class_delegate () {
+               return mono_test_marshal_inout_byval_class_delegate (new InOutByvalClassDelegate (delegate_test_byval_class_inout));
+       }
+
        /*
         * Returning string arrays
         */