Merge pull request #5428 from kumpera/wasm-support-p2
[mono.git] / mono / tests / marshal9.cs
index ce506e698119754b118d3aef6eac622ecf4703ae..f19059435939a60dfc0eafec50e2c05d152b8594 100644 (file)
@@ -5,6 +5,11 @@
 using System;
 using System.Runtime.InteropServices;
 
+[AttributeUsage (AttributeTargets.Method)]
+sealed class MonoPInvokeCallbackAttribute : Attribute {
+       public MonoPInvokeCallbackAttribute (Type t) {}
+}
+
 public class Marshal1 : ICustomMarshaler
 {
        int param;
@@ -78,6 +83,7 @@ public class Tests
 {
        public static int Main (string[] args) {
                return TestDriver.RunTests (typeof (Tests));
+       return 0;
        }
 
        [DllImport ("libtest")]
@@ -90,6 +96,7 @@ public class Tests
 
                Marshal1.cleanup_managed_count = 0;
                Marshal1.cleanup_native_count = 0;
+               Marshal1.native_to_managed_count = 0;
 
                int res = (int)mono_test_marshal_pass_return_custom (5, 10, 5);
 
@@ -97,6 +104,8 @@ public class Tests
                        return 1;
                if (Marshal1.cleanup_native_count != 2)
                        return 2;
+               if (Marshal1.native_to_managed_count != 1)
+                       return 3;
 
                return res == 15 ? 0 : 3;
        }
@@ -228,10 +237,12 @@ public class Tests
        [DllImport ("libtest")]
        private static extern int mono_test_marshal_pass_return_custom_null_in_delegate (pass_return_int_delegate del);
 
+       [MonoPInvokeCallback (typeof (pass_return_int_delegate))]
        private static object pass_return_int (object i) {
                return (int)i;
        }
 
+       [MonoPInvokeCallback (typeof (pass_return_int_delegate))]
        private static object pass_return_null (object i) {
                return (i == null) ? null : new Object ();
        }
@@ -427,7 +438,8 @@ public class Tests
 
                return 0;
        }
-       
+
+       [MonoPInvokeCallback (typeof (custom_out_param_delegate))]
        private static void custom_out_param (out object i) 
        {
                i = new object();