[Mono-bugs] [Bug 50116][Wis] Changed - Marshaling/PInvoke bug?

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 25 Oct 2003 16:19:00 -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=50116

--- shadow/50116	2003-10-25 09:02:00.000000000 -0400
+++ shadow/50116.tmp.2751	2003-10-25 16:19:00.000000000 -0400
@@ -1,13 +1,13 @@
 Bug#: 50116
 Product: Mono/Runtime
 Version: unspecified
 OS: other
 OS Details: Debian Sid
-Status: NEW   
-Resolution: 
+Status: RESOLVED   
+Resolution: FIXED
 Severity: Unknown
 Priority: Wishlist
 Component: misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: pbaena@uol.com.ar               
 QAContact: mono-bugs@ximian.com
@@ -124,6 +124,27 @@
 	Console.WriteLine (chars); 
  
 	g_free (ptr); 
 } 
  
 }
+
+------- Additional Comments From vargaz@freemail.hu  2003-10-25 16:18 -------
+The program does not work because the managed prototype for the
+memmove function is incorrect. Arrays by default are marshalled as In
+arguments, meaning the changes made to the array by the unmanaged 
+function are discarded by the runtime. See:
+
+http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconmarshalingarraysoftypes.asp
+
+So the correct prototype for the memmove function might be:
+
+public static extern void memmove([In, Out] int[] dest, int src, int
+size); 
+
+The reason why this worked in 0.28 was that array marshalling was not
+implemented at all, so the runtime simply passed the managed array
+to the unmanaged code, without any copying.
+
+
+
+