[Mono-bugs] [Bug 28383][Nor] New - Delegates, PInvoke, DynamicInvoke and some *weird* behavior ;-)
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
31 Jul 2002 02:08:50 -0000
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by manyoso@yahoo.com.
http://bugzilla.ximian.com/show_bug.cgi?id=28383
--- shadow/28383 Tue Jul 30 22:08:50 2002
+++ shadow/28383.tmp.17839 Tue Jul 30 22:08:50 2002
@@ -0,0 +1,59 @@
+Bug#: 28383
+Product: Mono/Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: manyoso@yahoo.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Delegates, PInvoke, DynamicInvoke and some *weird* behavior ;-)
+
+We've encountered some weird behavior with mono... Let's just get to the code:
+
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting.Messaging;
+
+class Test {
+ public delegate int SimpleDelegate (int a, int b);
+
+ [DllImport ("libtest.so", EntryPoint="mono_invoke_delegate")]
+ static extern int mono_invoke_delegate (SimpleDelegate d);
+
+ public int CallBack (int a, int b) {
+ Console.WriteLine (this);
+ return 0;
+ }
+
+ static void Main () {
+ Test t = new Test ();
+ SimpleDelegate d = new SimpleDelegate (t.CallBack);
+ mono_invoke_delegate (d);
+ d.DynamicInvoke (new Object[] {2,3});
+ }
+}
+
+Put this in /mono/mono/mono/tests and compile.
+
+The output i receive looks like this:
+
+start invoke 0x812e3e8
+Test+SimpleDelegate
+end invoke
+Test
+
+I was expecting this:
+
+start invoke 0x812e3e8
+Test
+end invoke
+Test