Expose MarshalAsAttribute to the runtime.
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 5 Nov 2012 19:02:58 +0000 (14:02 -0500)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 5 Nov 2012 19:16:12 +0000 (14:16 -0500)
mcs/class/corlib/System.Runtime.InteropServices/MarshalAsAttribute.cs
mono/metadata/object-internals.h

index 9bb9e9a92576c4320e4cc0437d5218784e0b4215..ac0dc4145bf48cb1de2325e824e43e2cd11404b5 100644 (file)
@@ -35,25 +35,29 @@ namespace System.Runtime.InteropServices {
        [ComVisible(true)]
        [AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | 
                         AttributeTargets.ReturnValue, Inherited=false)]
+       [StructLayout (LayoutKind.Sequential)]
        public sealed class MarshalAsAttribute : Attribute {
-               private UnmanagedType utype;
-               public UnmanagedType ArraySubType;
+               /*keep these fields in sync with object-internals.h*/
+#pragma warning disable 169, 414
                public string MarshalCookie;
-
                [ComVisible(true)]
                public string MarshalType;
 
                [ComVisible(true)]
                public Type MarshalTypeRef;
-               
+               public Type SafeArrayUserDefinedSubType;
+
+               private UnmanagedType utype;
+               public UnmanagedType ArraySubType;              
 #if !MOONLIGHT
                public VarEnum SafeArraySubType;
+#else
+               private int SafeArraySubType;
 #endif
-
                public int SizeConst;
-               public short SizeParamIndex;
-               public Type SafeArrayUserDefinedSubType;
                public int IidParameterIndex;
+               public short SizeParamIndex;
+#pragma warning disable 169, 414
 
                public MarshalAsAttribute (short unmanagedType) {
                        utype = (UnmanagedType)unmanagedType;
@@ -64,5 +68,10 @@ namespace System.Runtime.InteropServices {
                public UnmanagedType Value {
                        get {return utype;}
                }
+
+               internal MarshalAsAttribute Copy ()
+               {
+                       return (MarshalAsAttribute)this.MemberwiseClone ();
+               }
        }
 }
index 0d2f459899574081a143cba19145b7ad0ab3bb83..e51f5de87640151bd3a26841afcc40cb929e9ed5 100644 (file)
@@ -1226,6 +1226,21 @@ typedef struct {
        MonoArray *data;
 } MonoReflectionCustomAttr;
 
+typedef struct {
+       MonoObject object;
+       MonoString *marshal_cookie;
+       MonoString *marshal_type;
+       MonoReflectionType *marshal_type_ref;
+       MonoReflectionType *marshal_safe_array_user_defined_subtype;
+       guint32 utype;
+       guint32 array_subtype;
+       gint32 safe_array_subtype;
+       gint32 size_const;
+       gint32 IidParameterIndex;
+       gint16 size_param_index;
+} MonoReflectionMarshalAsAttribute;
+
+
 typedef struct {
        MonoObject object;
        gint32 call_conv;