[Mono-bugs] [Bug 79312][Maj] New - returning a struct by value giving unexpected results

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Sep 6 22:06:17 EDT 2006


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 james.eberle at comcast.net.

http://bugzilla.ximian.com/show_bug.cgi?id=79312

--- shadow/79312	2006-09-06 22:06:17.000000000 -0400
+++ shadow/79312.tmp.27929	2006-09-06 22:06:17.000000000 -0400
@@ -0,0 +1,62 @@
+Bug#: 79312
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: Mac OSX 10.4.7, G4
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: interop
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: james.eberle at comcast.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: returning a struct by value giving unexpected results
+
+Description of Problem:
+- Declaring an Invoke/P function that returns a struct does not return the
+correct values.
+
+Steps to reproduce the problem:
+- Here's the code:
+
+$ cat q.cs
+using System;
+using System.Runtime.InteropServices;
+
+public struct INT {
+  public int h;
+}
+
+public struct HI {
+  public const string LIB =
+"/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox";
+
+  public static void Main() {
+    int a = GetCurrentEventLoop1();
+    INT b = GetCurrentEventLoop2();
+    Console.WriteLine("{0:x} {1:x}", a, b.h);
+  }
+
+  [DllImport(LIB, EntryPoint="GetCurrentEventLoop")]
+  public static extern int GetCurrentEventLoop1();
+
+  [DllImport(LIB, EntryPoint="GetCurrentEventLoop")]
+  public static extern INT GetCurrentEventLoop2();
+
+}
+
+Actual Results:
+
+$ mcs -warn:4 -t:exe -out:q.exe q.cs
+$ mono q.exe
+77629a0b e214c9f1
+
+Expected Results:
+- The two values should match
+
+How often does this happen? 
+- Always


More information about the mono-bugs mailing list