2 using System.Threading;
3 using System.Runtime.InteropServices;
4 using System.Runtime.Remoting.Messaging;
7 public delegate int SimpleDelegate (int a, int b);
9 [DllImport ("libtest", EntryPoint="mono_invoke_delegate")]
10 static extern int mono_invoke_delegate (SimpleDelegate d);
12 public static int Add (int a, int b) {
13 Console.WriteLine ("Test.Add from delegate: " + a + " + " + b);
17 public static int Add2 (int a, int b) {
18 Console.WriteLine ("Test.Add2 from delegate: " + a + " + " + b);
23 SimpleDelegate d = new SimpleDelegate (Add);
24 SimpleDelegate d2 = new SimpleDelegate (Add2);
26 if (mono_invoke_delegate (d) != 5)
29 if (mono_invoke_delegate (d2) != 5)