[Mono-bugs] [Bug 74875][Nor] Changed - Custom marshaling differences between Mono and .NET Framework

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 12 May 2005 10:43:50 -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 kornelpal@hotmail.com.

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

--- shadow/74875	2005-05-12 10:08:34.000000000 -0400
+++ shadow/74875.tmp.6322	2005-05-12 10:43:50.000000000 -0400
@@ -69,6 +69,26 @@
 Sincerely,
 Kornél
 
 ------- Additional Comments From vargaz@gmail.com  2005-05-12 10:08 -------
 Could you give an example for case (5) ?
 
+
+------- Additional Comments From kornelpal@hotmail.com  2005-05-12 10:43 -------
+I give you a C# method declaration as example if you need more info, 
+please let me know.
+
+Form UCOMIStream.cs:
+void Read ([Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 
+1)] byte[] pv, int cb, IntPtr pcbRead);
+
+In .NET Framework:
+By default arrays are passed as [In] parameters. However if you set 
+[In, Out] or [Out] they are copied back form the unmanaged memory to 
+the managed array.
+
+If you specify [Out] only the unmanaged memory is uninitialized and 
+is copied back to the managed array when the function returns.
+
+This is the marshaling behaviour for non-reference array arguments.
+
+Mono should do the same.