Merge pull request #321 from RAOF/aot-cpu-safety
[mono.git] / mcs / class / corlib / System.Reflection.Emit / UnmanagedMarshal.cs
old mode 100755 (executable)
new mode 100644 (file)
index 096fafc..b9ed853
@@ -37,8 +37,12 @@ using System;
 
 namespace System.Reflection.Emit {
 
+       [Obsolete ("An alternate API is available: Emit the MarshalAs custom attribute instead.")]
+       [ComVisible (true)]
        [Serializable]
+       [StructLayout (LayoutKind.Sequential)]
        public sealed class UnmanagedMarshal {
+#pragma warning disable 169, 414
                private int count;
                private UnmanagedType t;
                private UnmanagedType tbase;
@@ -48,6 +52,7 @@ namespace System.Reflection.Emit {
                Type marshaltyperef;
                private int param_num;
                private bool has_size;
+#pragma warning restore 169, 414
                
                private UnmanagedMarshal (UnmanagedType maint, int cnt) {
                        count = cnt;
@@ -100,19 +105,18 @@ namespace System.Reflection.Emit {
                        return new UnmanagedMarshal (unmanagedType, unmanagedType);
                }
 
-               /* this one is missing from the MS implementation */
-               public static UnmanagedMarshal DefineCustom (Type typeref, string cookie, string mtype, Guid id) {
+               internal static UnmanagedMarshal DefineCustom (Type typeref, string cookie, string mtype, Guid id) {
                        UnmanagedMarshal res = new UnmanagedMarshal (UnmanagedType.CustomMarshaler, UnmanagedType.CustomMarshaler);
                        res.mcookie = cookie;
                        res.marshaltype = mtype;
                        res.marshaltyperef = typeref;
                        if (id == Guid.Empty)
-                               res.guid = "";
+                               res.guid = String.Empty;
                        else
                                res.guid = id.ToString ();
                        return res;
                }
-
+               
                // sizeConst and sizeParamIndex can be -1 meaning they are not specified
                internal static UnmanagedMarshal DefineLPArrayInternal (UnmanagedType elemType, int sizeConst, int sizeParamIndex) {
                        UnmanagedMarshal res = new UnmanagedMarshal (UnmanagedType.LPArray, elemType);