ICALL(MARSHAL_54, "GetRawIUnknownForComObjectNoAddRef", ves_icall_System_Runtime_InteropServices_Marshal_GetRawIUnknownForComObjectNoAddRef)
ICALL(MARSHAL_48, "IsComObject", ves_icall_System_Runtime_InteropServices_Marshal_IsComObject)
#endif
-ICALL(MARSHAL_12, "OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf)
-ICALL(MARSHAL_13, "Prelink", ves_icall_System_Runtime_InteropServices_Marshal_Prelink)
-ICALL(MARSHAL_14, "PrelinkAll", ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll)
+HANDLES(ICALL(MARSHAL_12, "OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf))
+HANDLES(ICALL(MARSHAL_13, "Prelink", ves_icall_System_Runtime_InteropServices_Marshal_Prelink))
+HANDLES(ICALL(MARSHAL_14, "PrelinkAll", ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll))
HANDLES(ICALL(MARSHAL_15, "PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi))
ICALL(MARSHAL_16, "PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len)
ICALL(MARSHAL_17, "PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR)
ICALL(MARSHAL_49, "ReleaseComObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal)
ICALL(MARSHAL_29, "ReleaseInternal", ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal)
#endif
-ICALL(MARSHAL_30, "SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf)
+HANDLES(ICALL(MARSHAL_30, "SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf))
ICALL(MARSHAL_31, "StringToBSTR", ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR)
ICALL(MARSHAL_32, "StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi)
ICALL(MARSHAL_33, "StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni)
return;
mono_lookup_pinvoke_call (method, &exc_class, &exc_arg);
if (exc_class) {
- mono_error_set_exception_instance (error,
- mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg));
+ mono_error_set_generic_error (error, "System", exc_class, "%s", exc_arg);
return;
}
/* create the wrapper, too? */
}
ICALL_EXPORT void
-ves_icall_System_Runtime_InteropServices_Marshal_Prelink (MonoReflectionMethod *method)
+ves_icall_System_Runtime_InteropServices_Marshal_Prelink (MonoReflectionMethodHandle method, MonoError *error)
{
- MonoError error;
+ error_init (error);
- prelink_method (method->method, &error);
- mono_error_set_pending_exception (&error);
+ prelink_method (MONO_HANDLE_GETVAL (method, method), error);
}
ICALL_EXPORT void
-ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionType *type)
+ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionTypeHandle type, MonoError *error)
{
- MonoError error;
- MonoClass *klass = mono_class_from_mono_type (type->type);
+ error_init (error);
+ MonoClass *klass = mono_class_from_mono_type (MONO_HANDLE_GETVAL (type, type));
MonoMethod* m;
gpointer iter = NULL;
- mono_class_init_checked (klass, &error);
- if (mono_error_set_pending_exception (&error))
- return;
+ mono_class_init_checked (klass, error);
+ return_if_nok (error);
while ((m = mono_class_get_methods (klass, &iter))) {
- prelink_method (m, &error);
- if (mono_error_set_pending_exception (&error))
- return;
+ prelink_method (m, error);
+ return_if_nok (error);
}
}
}
guint32
-ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rtype)
+ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionTypeHandle rtype, MonoError *error)
{
MonoClass *klass;
MonoType *type;
guint32 layout;
- MONO_CHECK_ARG_NULL (rtype, 0);
+ error_init (error);
+
+ if (MONO_HANDLE_IS_NULL (rtype)) {
+ mono_error_set_argument_null (error, "type", "");
+ return 0;
+ }
- type = rtype->type;
+ type = MONO_HANDLE_GETVAL (rtype, type);
klass = mono_class_from_mono_type (type);
if (!mono_class_init (klass)) {
- mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
+ mono_error_set_for_class_failure (error, klass);
return 0;
}
if (type->type == MONO_TYPE_PTR || type->type == MONO_TYPE_FNPTR) {
return sizeof (gpointer);
} else if (layout == TYPE_ATTRIBUTE_AUTO_LAYOUT) {
- gchar *msg;
- MonoException *exc;
-
- msg = g_strdup_printf ("Type %s cannot be marshaled as an unmanaged structure.", klass->name);
- exc = mono_get_exception_argument ("t", msg);
- g_free (msg);
- mono_set_pending_exception (exc);
+ mono_error_set_argument (error, "t", "Type %s cannot be marshaled as an unmanaged structure.", klass->name);
return 0;
}
}
int
-ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *type, MonoString *field_name)
+ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionTypeHandle ref_type, MonoStringHandle field_name, MonoError *error)
{
- MonoError error;
- MonoMarshalType *info;
- MonoClass *klass;
- char *fname;
- int match_index = -1;
-
- MONO_CHECK_ARG_NULL (type, 0);
- MONO_CHECK_ARG_NULL (field_name, 0);
-
- fname = mono_string_to_utf8_checked (field_name, &error);
- if (mono_error_set_pending_exception (&error))
+ error_init (error);
+ if (MONO_HANDLE_IS_NULL (ref_type)) {
+ mono_error_set_argument_null (error, "type", "");
return 0;
- klass = mono_class_from_mono_type (type->type);
+ }
+ if (MONO_HANDLE_IS_NULL (field_name)) {
+ mono_error_set_argument_null (error, "fieldName", "");
+ return 0;
+ }
+
+ char *fname = mono_string_handle_to_utf8 (field_name, error);
+ return_val_if_nok (error, 0);
+
+ MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
+ MonoClass *klass = mono_class_from_mono_type (type);
if (!mono_class_init (klass)) {
- mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
+ mono_error_set_for_class_failure (error, klass);
return 0;
}
+ int match_index = -1;
while (klass && match_index == -1) {
MonoClassField* field;
int i = 0;
g_free (fname);
if(match_index == -1) {
- MonoException* exc;
- gchar *tmp;
-
/* Get back original class instance */
- klass = mono_class_from_mono_type (type->type);
+ klass = mono_class_from_mono_type (type);
- tmp = g_strdup_printf ("Field passed in is not a marshaled member of the type %s", klass->name);
- exc = mono_get_exception_argument ("fieldName", tmp);
- g_free (tmp);
-
- mono_set_pending_exception ((MonoException*)exc);
+ mono_error_set_argument (error, "fieldName", "Field passed in is not a marshaled member of the type %s", klass->name);
return 0;
}
- info = mono_marshal_load_type_info (klass);
+ MonoMarshalType *info = mono_marshal_load_type_info (klass);
return info->fields [match_index].offset;
}
ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error (void);
guint32
-ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rtype);
+ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionTypeHandle rtype, MonoError *error);
void
ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObject *obj, gpointer dst, MonoBoolean delete_old);
ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gpointer src, MonoReflectionType *type);
int
-ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *type, MonoString *field_name);
+ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionTypeHandle type, MonoStringHandle field_name, MonoError *error);
gpointer
ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR (MonoString *string);