return res;
}
-
- internal MarshalAsAttribute ToMarshalAsAttribute () {
- MarshalAsAttribute attr = new MarshalAsAttribute (t);
- attr.ArraySubType = tbase;
- attr.MarshalCookie = mcookie;
- attr.MarshalType = marshaltype;
- attr.MarshalTypeRef = marshaltyperef;
- if (count == -1)
- attr.SizeConst = 0;
- else
- attr.SizeConst = count;
- if (param_num == -1)
- attr.SizeParamIndex = 0;
- else
- attr.SizeParamIndex = (short)param_num;
- return attr;
- }
}
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System.Diagnostics;
-using System.Reflection.Emit;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern UnmanagedMarshal GetUnmanagedMarshal ();
+ private extern MarshalAsAttribute get_marshal_info ();
internal object[] GetPseudoCustomAttributes ()
{
if (DeclaringType.IsExplicitLayout)
count ++;
- UnmanagedMarshal marshalAs = UMarshal;
+ MarshalAsAttribute marshalAs = get_marshal_info ();
if (marshalAs != null)
count ++;
if (DeclaringType.IsExplicitLayout)
attrs [count ++] = new FieldOffsetAttribute (GetFieldOffset ());
if (marshalAs != null)
- attrs [count ++] = marshalAs.ToMarshalAsAttribute ();
+ attrs [count ++] = marshalAs;
return attrs;
}
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- static extern UnmanagedMarshal get_retval_marshal (IntPtr handle);
+ static extern MarshalAsAttribute get_retval_marshal (IntPtr handle);
static internal ParameterInfo GetReturnParameterInfo (MonoMethod method)
{
protected string NameImpl;
protected int PositionImpl;
protected ParameterAttributes AttrsImpl;
- private UnmanagedMarshal marshalAs;
- //ParameterInfo parent;
+ private MarshalAsAttribute marshalAs;
protected ParameterInfo () {
}
}
/* to build a ParameterInfo for the return type of a method */
- internal ParameterInfo (Type type, MemberInfo member, UnmanagedMarshal marshalAs) {
+ internal ParameterInfo (Type type, MemberInfo member, MarshalAsAttribute marshalAs) {
this.ClassImpl = type;
this.MemberImpl = member;
this.NameImpl = "";
attrs [count ++] = new OutAttribute ();
if (marshalAs != null)
- attrs [count ++] = marshalAs.ToMarshalAsAttribute ();
+ attrs [count ++] = marshalAs.Copy ();
return attrs;
}
* of icalls, do not require an increment.
*/
#pragma warning disable 169
- private const int mono_corlib_version = 107;
+ private const int mono_corlib_version = 108;
#pragma warning restore 169
[ComVisible (true)]
* Changes which are already detected at runtime, like the addition
* of icalls, do not require an increment.
*/
-#define MONO_CORLIB_VERSION 107
+#define MONO_CORLIB_VERSION 108
typedef struct
{
ICALL_TYPE(FIELDI, "System.Reflection.FieldInfo", FILEDI_1)
ICALL(FILEDI_1, "GetTypeModifiers", ves_icall_System_Reflection_FieldInfo_GetTypeModifiers)
-ICALL(FILEDI_2, "GetUnmanagedMarshal", ves_icall_System_Reflection_FieldInfo_GetUnmanagedMarshal)
+ICALL(FILEDI_2, "get_marshal_info", ves_icall_System_Reflection_FieldInfo_get_marshal_info)
ICALL(FILEDI_3, "internal_from_handle_type", ves_icall_System_Reflection_FieldInfo_internal_from_handle_type)
ICALL_TYPE(MEMBERI, "System.Reflection.MemberInfo", MEMBERI_1)
return klass->flags;
}
-ICALL_EXPORT MonoReflectionMarshal*
-ves_icall_System_Reflection_FieldInfo_GetUnmanagedMarshal (MonoReflectionField *field)
+ICALL_EXPORT MonoReflectionMarshalAsAttribute*
+ves_icall_System_Reflection_FieldInfo_get_marshal_info (MonoReflectionField *field)
{
MonoClass *klass = field->field->parent;
MonoMarshalType *info;
if (!info->fields [i].mspec)
return NULL;
else
- return mono_reflection_marshal_from_marshal_spec (field->object.vtable->domain, klass, info->fields [i].mspec);
+ return mono_reflection_marshal_as_attribute_from_marshal_spec (field->object.vtable->domain, klass, info->fields [i].mspec);
}
}
return mono_param_get_objects_internal (domain, method, member->reftype ? mono_class_from_mono_type (member->reftype->type) : NULL);
}
-ICALL_EXPORT MonoReflectionMarshal*
+ICALL_EXPORT MonoReflectionMarshalAsAttribute*
ves_icall_System_MonoMethodInfo_get_retval_marshal (MonoMethod *method)
{
MonoDomain *domain = mono_domain_get ();
- MonoReflectionMarshal* res = NULL;
+ MonoReflectionMarshalAsAttribute* res = NULL;
MonoMarshalSpec **mspecs;
int i;
mono_method_get_marshal_info (method, mspecs);
if (mspecs [0])
- res = mono_reflection_marshal_from_marshal_spec (domain, method->klass, mspecs [0]);
+ res = mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspecs [0]);
for (i = mono_method_signature (method)->param_count; i >= 0; i--)
if (mspecs [i])
MonoArray *mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig) MONO_INTERNAL;
-MonoReflectionMarshal* mono_reflection_marshal_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec) MONO_INTERNAL;
+MonoReflectionMarshalAsAttribute* mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec) MONO_INTERNAL;
gpointer
mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context) MONO_INTERNAL;
}
if (mspecs [i + 1])
- MONO_OBJECT_SETREF (param, MarshalAsImpl, (MonoObject*)mono_reflection_marshal_from_marshal_spec (domain, method->klass, mspecs [i + 1]));
+ MONO_OBJECT_SETREF (param, MarshalAsImpl, (MonoObject*)mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspecs [i + 1]));
mono_array_setref (res, i, param);
}
}
#endif /* !DISABLE_REFLECTION_EMIT */
-MonoReflectionMarshal*
-mono_reflection_marshal_from_marshal_spec (MonoDomain *domain, MonoClass *klass,
+MonoReflectionMarshalAsAttribute*
+mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass,
MonoMarshalSpec *spec)
{
- static MonoClass *System_Reflection_Emit_UnmanagedMarshalClass;
- MonoReflectionMarshal *minfo;
+ static MonoClass *System_Reflection_Emit_MarshalAsAttribute;
+ MonoReflectionMarshalAsAttribute *minfo;
MonoType *mtype;
- if (!System_Reflection_Emit_UnmanagedMarshalClass) {
- System_Reflection_Emit_UnmanagedMarshalClass = mono_class_from_name (
- mono_defaults.corlib, "System.Reflection.Emit", "UnmanagedMarshal");
- g_assert (System_Reflection_Emit_UnmanagedMarshalClass);
+ if (!System_Reflection_Emit_MarshalAsAttribute) {
+ System_Reflection_Emit_MarshalAsAttribute = mono_class_from_name (
+ mono_defaults.corlib, "System.Runtime.InteropServices", "MarshalAsAttribute");
+ g_assert (System_Reflection_Emit_MarshalAsAttribute);
}
- minfo = (MonoReflectionMarshal*)mono_object_new (domain, System_Reflection_Emit_UnmanagedMarshalClass);
- minfo->type = spec->native;
+ minfo = (MonoReflectionMarshalAsAttribute*)mono_object_new (domain, System_Reflection_Emit_MarshalAsAttribute);
+ minfo->utype = spec->native;
- switch (minfo->type) {
+ switch (minfo->utype) {
case MONO_NATIVE_LPARRAY:
- minfo->eltype = spec->data.array_data.elem_type;
- minfo->count = spec->data.array_data.num_elem;
- minfo->param_num = spec->data.array_data.param_num;
+ minfo->array_subtype = spec->data.array_data.elem_type;
+ minfo->size_const = spec->data.array_data.num_elem;
+ if (spec->data.array_data.param_num != -1)
+ minfo->size_param_index = spec->data.array_data.param_num;
break;
case MONO_NATIVE_BYVALTSTR:
case MONO_NATIVE_BYVALARRAY:
- minfo->count = spec->data.array_data.num_elem;
+ minfo->size_const = spec->data.array_data.num_elem;
break;
case MONO_NATIVE_CUSTOM:
if (spec->data.custom_data.custom_name) {
mtype = mono_reflection_type_from_name (spec->data.custom_data.custom_name, klass->image);
if (mtype)
- MONO_OBJECT_SETREF (minfo, marshaltyperef, mono_type_get_object (domain, mtype));
+ MONO_OBJECT_SETREF (minfo, marshal_type_ref, mono_type_get_object (domain, mtype));
- MONO_OBJECT_SETREF (minfo, marshaltype, mono_string_new (domain, spec->data.custom_data.custom_name));
+ MONO_OBJECT_SETREF (minfo, marshal_type, mono_string_new (domain, spec->data.custom_data.custom_name));
}
if (spec->data.custom_data.cookie)
- MONO_OBJECT_SETREF (minfo, mcookie, mono_string_new (domain, spec->data.custom_data.cookie));
+ MONO_OBJECT_SETREF (minfo, marshal_cookie, mono_string_new (domain, spec->data.custom_data.cookie));
break;
default: