[Mono-bugs] [Bug 48026][Min] Changed - C++ object return-by-value breaks P/Invoke argument passing

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 12 Oct 2003 15:54:52 -0400 (EDT)


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 vargaz@freemail.hu.

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

--- shadow/48026	2003-08-29 11:44:47.000000000 -0400
+++ shadow/48026.tmp.30493	2003-10-12 15:54:52.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 48026
 Product: Mono/Runtime
 Version: unspecified
-OS: 
+OS: unknown
 OS Details: Red Hat 8.0
-Status: NEW   
-Resolution: 
-Severity: 
+Status: RESOLVED   
+Resolution: NOTABUG
+Severity: Unknown
 Priority: Minor
 Component: misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: patrick@vrac.iastate.edu               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -227,6 +227,24 @@
       DataUser u = new DataUser();
       Console.WriteLine("Reference copy value: " + u.getByCopy());
    }
 }
 
 }
+
+------- Additional Comments From vargaz@freemail.hu  2003-10-12 15:54 -------
+I think the test program is not correct: according to the MSDN docs,
+when the unmanaged function returns a structure by value , the 
+corresponding managed type must be a structure:
+
+http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconpassingstructures.asp
+
+I think using a custom marshaller makes no difference here.
+
+The fact that your example works under MS.NET is probably a
+coincidance. Try adding a second field to the managed and unmanaged 
+structures and it will no longer work. Also, the 
+MarshalNativeToManaged function seems wrong. It should be:
+
+obj.x = (uint) Marshal.ReadInt32 (nativeObj);
+
+