[Mono-bugs] [Bug 77230][Nor] New - Marshalling C unions not working anymore

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jan 12 14:28:07 EST 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 maurits.rijk at philips.com.

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

--- shadow/77230	2006-01-12 14:28:07.000000000 -0500
+++ shadow/77230.tmp.14928	2006-01-12 14:28:07.000000000 -0500
@@ -0,0 +1,42 @@
+Bug#: 77230
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: interop
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: maurits.rijk at philips.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Marshalling C unions not working anymore
+
+Until mono 1.1.12 I was able to marshal C unions by using a struct with an
+explicit layout and all the field offsets set to zero, as shown in the
+following piece of code:
+
+  [StructLayout(LayoutKind.Explicit)]
+    public struct ParamData
+    {
+      [FieldOffset(0)]
+      public Int32	d_int32;
+      [FieldOffset(0)]
+      public Int16	d_int16;
+      [FieldOffset(0)]
+      public byte	d_int8;
+    }
+
+However in mono 1.1.13 this doesn't work anymore. The compiler doesn't
+complain, but at runtime I always get the follow error:
+
+** ERROR **: Type Gimp.ParamData which has an [ExplicitLayout] attribute
+cannot have two fields with the same offset.
+
+On win32 with .NET 2.0 I don't get this error.
+
+I will try to come up with a small example if needed.


More information about the mono-bugs mailing list