[Mono-bugs] [Bug 77230][Nor] Changed - Marshalling C unions not
working anymore
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Jan 17 16:28:02 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-13 03:43:47.000000000 -0500
+++ shadow/77230.tmp.4785 2006-01-17 16:28:02.000000000 -0500
@@ -77,6 +77,54 @@
The union I'm trying to marshall is more complicated than the part
I've shown above. Robert: I will use your code as starting point and
try to come up with a minimal example that doesn't work anymore.
My actual code has to marshal an array of structs, where each of this
struct contains a more complicated version of the union shown above.
+
+------- Additional Comments From maurits.rijk at philips.com 2006-01-17 16:28 -------
+A bit more info (still no working testcase): the code fails in a call to
+
+Marshal.PtrToStructure(paramPtr, typeof(GimpParam));
+
+where paramPtr is an IntPtr and GimpParam is defined as:
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct GimpParam
+ {
+ public PDBArgType type;
+ public ParamData data;
+ };
+
+PDBArgtype is an enum, while ParamData is defined as:
+
+ [StructLayout(LayoutKind.Explicit)]
+ public struct ParamData
+ {
+ [FieldOffset(0)]
+ public Int32 d_int32;
+ [FieldOffset(0)]
+ public Int16 d_int16;
+ [FieldOffset(0)]
+ public byte d_int8;
+ [FieldOffset(0)]
+ public double d_float;
+ [FieldOffset(0)]
+ public IntPtr d_string;
+ [FieldOffset(0)]
+ public GimpRGB d_color;
+ [FieldOffset(0)]
+ public Int32 d_image;
+ [FieldOffset(0)]
+ public Int32 d_drawable;
+ [FieldOffset(0)]
+ public PDBStatusType d_status;
+ };
+
+and
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct GimpRGB
+ {
+ public double r, g, b, a;
+ }
+
More information about the mono-bugs
mailing list