5 * Dietmar Maurer (dietmar@ximian.com)
6 * Paolo Molaro (lupus@ximian.com)
8 * (C) 2001 Ximian, Inc.
17 #if defined (PLATFORM_WIN32)
21 #include <mono/metadata/object.h>
22 #include <mono/metadata/threads.h>
23 #include <mono/metadata/reflection.h>
24 #include <mono/metadata/assembly.h>
25 #include <mono/metadata/tabledefs.h>
26 #include <mono/metadata/exception.h>
27 #include <mono/metadata/file-io.h>
28 #include <mono/metadata/socket-io.h>
29 #include <mono/metadata/mono-endian.h>
30 #include <mono/metadata/tokentype.h>
31 #include <mono/metadata/unicode.h>
32 #include <mono/metadata/appdomain.h>
33 #include <mono/metadata/rand.h>
34 #include <mono/metadata/sysmath.h>
35 #include <mono/metadata/debug-symfile.h>
36 #include <mono/io-layer/io-layer.h>
41 ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
48 ao = (MonoArray *)this;
49 ac = (MonoClass *)ao->obj.vtable->klass;
51 esize = mono_array_element_size (ac);
52 ea = (gpointer*)((char*)ao->vector + (pos * esize));
54 if (ac->element_class->valuetype)
55 return mono_value_box (this->vtable->domain, ac->element_class, ea);
61 ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs)
67 MONO_CHECK_ARG_NULL (idxs);
69 io = (MonoArray *)idxs;
70 ic = (MonoClass *)io->obj.vtable->klass;
72 ao = (MonoArray *)this;
73 ac = (MonoClass *)ao->obj.vtable->klass;
75 g_assert (ic->rank == 1);
76 if (io->bounds [0].length != ac->rank)
77 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
79 ind = (guint32 *)io->vector;
80 for (i = 0; i < ac->rank; i++)
81 if ((ind [i] < ao->bounds [i].lower_bound) ||
82 (ind [i] >= ao->bounds [i].length + ao->bounds [i].lower_bound))
83 mono_raise_exception (mono_get_exception_index_out_of_range ());
85 pos = ind [0] - ao->bounds [0].lower_bound;
86 for (i = 1; i < ac->rank; i++)
87 pos = pos*ao->bounds [i].length + ind [i] -
88 ao->bounds [i].lower_bound;
90 return ves_icall_System_Array_GetValueImpl (this, pos);
94 ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject *value, guint32 pos)
96 MonoClass *ac, *vc, *ec;
105 vc = value->vtable->klass;
109 ac = this->obj.vtable->klass;
110 ec = ac->element_class;
112 esize = mono_array_element_size (ac);
113 ea = (gpointer*)((char*)this->vector + (pos * esize));
114 va = (gpointer*)((char*)value + sizeof (MonoObject));
117 memset (ea, 0, esize);
121 #define NO_WIDENING_CONVERSION G_STMT_START{\
122 mono_raise_exception (mono_get_exception_argument ( \
123 "value", "not a widening conversion")); \
126 #define CHECK_WIDENING_CONVERSION(extra) G_STMT_START{\
127 if (esize < vsize + ## extra) \
128 mono_raise_exception (mono_get_exception_argument ( \
129 "value", "not a widening conversion")); \
132 #define INVALID_CAST G_STMT_START{\
133 mono_raise_exception (mono_get_exception_invalid_cast ()); \
136 /* Check element (destination) type. */
137 switch (ec->byval_arg.type) {
138 case MONO_TYPE_STRING:
139 switch (vc->byval_arg.type) {
140 case MONO_TYPE_STRING:
146 case MONO_TYPE_BOOLEAN:
147 switch (vc->byval_arg.type) {
148 case MONO_TYPE_BOOLEAN:
161 NO_WIDENING_CONVERSION;
168 if (!ec->valuetype) {
169 *ea = (gpointer)value;
173 if (mono_object_isinst (value, ec)) {
174 memcpy (ea, (char *)value + sizeof (MonoObject), esize);
181 vsize = mono_class_instance_size (vc) - sizeof (MonoObject);
184 g_message (G_STRLOC ": %d (%d) <= %d (%d)",
185 ec->byval_arg.type, esize,
186 vc->byval_arg.type, vsize);
189 #define ASSIGN_UNSIGNED(etype) G_STMT_START{\
190 switch (vc->byval_arg.type) { \
195 case MONO_TYPE_CHAR: \
196 CHECK_WIDENING_CONVERSION(0); \
197 *(## etype *) ea = (## etype) u64; \
199 /* You can't assign a signed value to an unsigned array. */ \
204 /* You can't assign a floating point number to an integer array. */ \
207 NO_WIDENING_CONVERSION; \
211 #define ASSIGN_SIGNED(etype) G_STMT_START{\
212 switch (vc->byval_arg.type) { \
217 CHECK_WIDENING_CONVERSION(0); \
218 *(## etype *) ea = (## etype) i64; \
220 /* You can assign an unsigned value to a signed array if the array's */ \
221 /* element size is larger than the value size. */ \
226 case MONO_TYPE_CHAR: \
227 CHECK_WIDENING_CONVERSION(1); \
228 *(## etype *) ea = (## etype) u64; \
230 /* You can't assign a floating point number to an integer array. */ \
233 NO_WIDENING_CONVERSION; \
237 #define ASSIGN_REAL(etype) G_STMT_START{\
238 switch (vc->byval_arg.type) { \
241 CHECK_WIDENING_CONVERSION(0); \
242 *(## etype *) ea = (## etype) r64; \
244 /* All integer values fit into a floating point array, so we don't */ \
245 /* need to CHECK_WIDENING_CONVERSION here. */ \
250 *(## etype *) ea = (## etype) i64; \
256 case MONO_TYPE_CHAR: \
257 *(## etype *) ea = (## etype) u64; \
262 switch (vc->byval_arg.type) {
264 u64 = *(guint8 *) va;
267 u64 = *(guint16 *) va;
270 u64 = *(guint32 *) va;
273 u64 = *(guint64 *) va;
279 i64 = *(gint16 *) va;
282 i64 = *(gint32 *) va;
285 i64 = *(gint64 *) va;
288 r64 = *(gfloat *) va;
291 r64 = *(gdouble *) va;
294 u64 = *(guint16 *) va;
296 case MONO_TYPE_BOOLEAN:
297 /* Boolean is only compatible with itself. */
298 switch (ec->byval_arg.type) {
310 NO_WIDENING_CONVERSION;
317 /* If we can't do a direct copy, let's try a widening conversion. */
318 switch (ec->byval_arg.type) {
320 ASSIGN_UNSIGNED (guint16);
322 ASSIGN_UNSIGNED (guint8);
324 ASSIGN_UNSIGNED (guint16);
326 ASSIGN_UNSIGNED (guint32);
328 ASSIGN_UNSIGNED (guint64);
330 ASSIGN_SIGNED (gint8);
332 ASSIGN_SIGNED (gint16);
334 ASSIGN_SIGNED (gint32);
336 ASSIGN_SIGNED (gint64);
338 ASSIGN_REAL (gfloat);
340 ASSIGN_REAL (gdouble);
344 /* Not reached, INVALID_CAST does not return. Just to avoid a compiler warning ... */
348 #undef NO_WIDENING_CONVERSION
349 #undef CHECK_WIDENING_CONVERSION
350 #undef ASSIGN_UNSIGNED
356 ves_icall_System_Array_SetValue (MonoArray *this, MonoObject *value,
362 MONO_CHECK_ARG_NULL (idxs);
364 ic = idxs->obj.vtable->klass;
365 ac = this->obj.vtable->klass;
367 g_assert (ic->rank == 1);
368 if (idxs->bounds [0].length != ac->rank)
369 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
371 ind = (guint32 *)idxs->vector;
372 for (i = 0; i < ac->rank; i++)
373 if ((ind [i] < this->bounds [i].lower_bound) ||
374 (ind [i] >= this->bounds [i].length + this->bounds [i].lower_bound))
375 mono_raise_exception (mono_get_exception_index_out_of_range ());
377 pos = ind [0] - this->bounds [0].lower_bound;
378 for (i = 1; i < ac->rank; i++)
379 pos = pos * this->bounds [i].length + ind [i] -
380 this->bounds [i].lower_bound;
382 ves_icall_System_Array_SetValueImpl (this, value, pos);
386 ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *lengths, MonoArray *bounds)
392 MONO_CHECK_ARG_NULL (type);
393 MONO_CHECK_ARG_NULL (lengths);
395 MONO_CHECK_ARG (lengths, mono_array_length (lengths) > 0);
397 MONO_CHECK_ARG (bounds, mono_array_length (lengths) == mono_array_length (bounds));
399 for (i = 0; i < mono_array_length (lengths); i++)
400 if (mono_array_get (lengths, gint32, i) < 0)
401 mono_raise_exception (mono_get_exception_argument_out_of_range (NULL));
403 aklass = mono_array_class_get (type->type, mono_array_length (lengths));
405 sizes = alloca (aklass->rank * sizeof(guint32) * 2);
406 for (i = 0; i < aklass->rank; ++i) {
407 sizes [i] = mono_array_get (lengths, gint32, i);
409 sizes [i + aklass->rank] = mono_array_get (bounds, gint32, i);
411 sizes [i + aklass->rank] = 0;
414 array = mono_array_new_full (mono_domain_get (), aklass, sizes, sizes + aklass->rank);
420 ves_icall_System_Array_GetRank (MonoObject *this)
422 return this->vtable->klass->rank;
426 ves_icall_System_Array_GetLength (MonoArray *this, gint32 dimension)
428 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
429 if ((dimension < 0) || (dimension >= rank))
430 mono_raise_exception (mono_get_exception_index_out_of_range ());
431 return this->bounds [dimension].length;
435 ves_icall_System_Array_GetLowerBound (MonoArray *this, gint32 dimension)
437 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
438 if ((dimension < 0) || (dimension >= rank))
439 mono_raise_exception (mono_get_exception_index_out_of_range ());
440 return this->bounds [dimension].lower_bound;
444 ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* dest, int dest_idx, int length)
446 int element_size = mono_array_element_size (source->obj.vtable->klass);
447 void * dest_addr = mono_array_addr_with_size (dest, element_size, dest_idx);
448 void * source_addr = mono_array_addr_with_size (source, element_size, source_idx);
450 g_assert (dest_idx + length <= mono_array_length (dest));
451 g_assert (source_idx + length <= mono_array_length (source));
452 memmove (dest_addr, source_addr, element_size * length);
456 ves_icall_InitializeArray (MonoArray *array, MonoClassField *field_handle)
458 MonoClass *klass = array->obj.vtable->klass;
459 guint32 size = mono_array_element_size (klass);
462 for (i = 0; i < klass->rank; ++i)
463 size *= array->bounds [i].length;
465 memcpy (mono_array_addr (array, char, 0), field_handle->data, size);
467 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
471 guint ## n *data = (guint ## n *) mono_array_addr (array, char, 0); \
473 for (i = 0; i < size; i += n/8, data++) { \
474 tmp = read ## n (data); \
479 printf ("Initialize array with elements of %s type\n", klass->element_class->name);
481 switch (klass->element_class->byval_arg.type) {
501 ves_icall_System_Object_MemberwiseClone (MonoObject *this)
503 return mono_object_clone (this);
507 ves_icall_System_Object_GetHashCode (MonoObject *this)
509 return *((gint32 *)this - 1);
513 * A hash function for value types. I have no idea if this is a good hash
514 * function (its similar to g_str_hash).
517 ves_icall_System_ValueType_GetHashCode (MonoObject *this)
523 MONO_CHECK_ARG_NULL (this);
525 size = this->vtable->klass->instance_size - sizeof (MonoObject);
527 p = (char *)this + sizeof (MonoObject);
529 for (i = 0; i < size; i++) {
530 h = (h << 5) - h + *p;
537 static MonoReflectionType *
538 ves_icall_System_Object_GetType (MonoObject *obj)
540 return mono_type_get_object (mono_domain_get (), &obj->vtable->klass->byval_arg);
544 mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
546 mtype->type = &obj->vtable->klass->byval_arg;
547 g_assert (mtype->type->type);
551 ves_icall_AssemblyBuilder_getToken (MonoReflectionAssemblyBuilder *assb, MonoObject *obj)
553 return mono_image_create_token (assb->dynamic_assembly, obj);
557 ves_icall_AssemblyBuilder_getPEHeader (MonoReflectionAssemblyBuilder *assb, MonoArray *buf, gint32 *data_size)
560 MonoDynamicAssembly *ass = assb->dynamic_assembly;
562 hsize = mono_image_get_header (assb, (char*)buf->vector, buf->bounds->length);
565 count = ass->code.index + ass->meta_size;
574 ves_icall_AssemblyBuilder_getDataChunk (MonoReflectionAssemblyBuilder *assb, MonoArray *buf)
576 int count, real_data;
577 MonoDynamicAssembly *ass = assb->dynamic_assembly;
578 char *p = mono_array_addr (buf, char, 0);
580 count = real_data = ass->code.index + ass->meta_size;
583 if (count > mono_array_length (buf))
587 memcpy (p, ass->code.data, ass->code.index);
588 p += ass->code.index;
589 memcpy (p, ass->assembly.image->raw_metadata, ass->meta_size);
591 /* null-pad section */
592 memset (p, 0, count);
594 return real_data + count;
597 static MonoReflectionType*
598 ves_icall_type_from_name (MonoString *name)
600 MonoDomain *domain = mono_domain_get ();
603 MonoTypeNameParse info;
606 str = mono_string_to_utf8 (name);
607 /*g_print ("requested type %s\n", str);*/
608 if (!mono_reflection_parse_type (str, &info)) {
610 g_list_free (info.modifiers);
615 image = mono_image_loaded (info.assembly);
616 /* do we need to load if it's not already loaded? */
619 g_list_free (info.modifiers);
623 image = mono_defaults.corlib;
625 type = mono_reflection_get_type (image, &info, FALSE);
627 g_list_free (info.modifiers);
630 /*g_print ("got it\n");*/
631 return mono_type_get_object (domain, type);
634 static MonoReflectionType*
635 ves_icall_type_from_handle (MonoType *handle)
637 MonoDomain *domain = mono_domain_get ();
638 MonoClass *klass = mono_class_from_mono_type (handle);
640 mono_class_init (klass);
641 return mono_type_get_object (domain, handle);
645 ves_icall_type_Equals (MonoReflectionType *type, MonoReflectionType *c)
647 if (type->type && c->type)
648 return mono_metadata_type_equal (type->type, c->type);
649 g_print ("type equals\n");
654 ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
660 g_assert (type != NULL);
662 domain = ((MonoObject *)type)->vtable->domain;
664 if (!c) /* FIXME: dont know what do do here */
667 klass = mono_class_from_mono_type (type->type);
668 klassc = mono_class_from_mono_type (c->type);
670 /* cut&paste from mono_object_isinst (): keep in sync */
671 if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && !(klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
672 MonoVTable *klass_vt = mono_class_vtable (domain, klass);
673 if ((klassc->interface_id <= klass->max_interface_id) &&
674 klass_vt->interface_offsets [klassc->interface_id])
676 } else if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && (klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
679 for (i = 0; i < klass->interface_count; i ++) {
680 MonoClass *ic = klass->interfaces [i];
686 * klass->baseval is 0 for interfaces
688 if (klass->baseval && ((klass->baseval - klassc->baseval) <= klassc->diffval))
695 ves_icall_get_attributes (MonoReflectionType *type)
697 MonoClass *klass = mono_class_from_mono_type (type->type);
703 ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
705 MonoDomain *domain = mono_domain_get ();
707 info->parent = mono_type_get_object (domain, &method->klass->byval_arg);
708 info->ret = mono_type_get_object (domain, method->signature->ret);
709 info->name = mono_string_new (domain, method->name);
710 info->attrs = method->flags;
711 info->implattrs = method->iflags;
715 ves_icall_get_parameter_info (MonoMethod *method)
717 MonoDomain *domain = mono_domain_get ();
719 static MonoClass *System_Reflection_ParameterInfo;
720 MonoReflectionParameter** args;
723 args = mono_param_get_objects (domain, method);
724 if (!System_Reflection_ParameterInfo)
725 System_Reflection_ParameterInfo = mono_class_from_name (
726 mono_defaults.corlib, "System.Reflection", "ParameterInfo");
727 res = mono_array_new (domain, System_Reflection_ParameterInfo, method->signature->param_count);
728 for (i = 0; i < method->signature->param_count; ++i) {
729 mono_array_set (res, gpointer, i, args [i]);
735 ves_icall_get_field_info (MonoReflectionField *field, MonoFieldInfo *info)
737 MonoDomain *domain = mono_domain_get ();
739 info->parent = mono_type_get_object (domain, &field->klass->byval_arg);
740 info->type = mono_type_get_object (domain, field->field->type);
741 info->name = mono_string_new (domain, field->field->name);
742 info->attrs = field->field->type->attrs;
746 ves_icall_MonoField_GetValue (MonoReflectionField *field, MonoObject *obj) {
749 MonoType *ftype = field->field->type;
750 int type = ftype->type;
754 mono_class_init (field->klass);
755 if (ftype->attrs & FIELD_ATTRIBUTE_STATIC) {
757 vtable = mono_class_vtable (mono_domain_get (), field->klass);
758 p = (char*)(vtable->data) + field->field->offset;
760 p = (char*)obj + field->field->offset;
764 case MONO_TYPE_OBJECT:
765 case MONO_TYPE_STRING:
766 case MONO_TYPE_SZARRAY:
767 case MONO_TYPE_ARRAY:
768 return *(MonoObject**)p;
770 klass = mono_class_from_mono_type (ftype);
771 res = mono_object_new (mono_domain_get (), klass);
772 r = (char*)res + sizeof (MonoObject);
773 memcpy (r, p, mono_class_value_size (klass, &align));
779 ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info)
781 MonoDomain *domain = mono_domain_get ();
783 info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
784 info->name = mono_string_new (domain, property->property->name);
785 info->attrs = property->property->attrs;
786 info->get = property->property->get ? mono_method_get_object (domain, property->property->get): NULL;
787 info->set = property->property->set ? mono_method_get_object (domain, property->property->set): NULL;
789 * There may be other methods defined for properties, though, it seems they are not exposed
790 * in the reflection API
795 ves_icall_Type_GetInterfaces (MonoReflectionType* type)
797 MonoDomain *domain = mono_domain_get ();
800 MonoClass *class = mono_class_from_mono_type (type->type);
804 for (parent = class; parent; parent = parent->parent) {
805 ninterf += parent->interface_count;
807 intf = mono_array_new (domain, mono_defaults.monotype_class, ninterf);
809 for (parent = class; parent; parent = parent->parent) {
810 for (i = 0; i < parent->interface_count; ++i) {
811 mono_array_set (intf, gpointer, ninterf, mono_type_get_object (domain, &parent->interfaces [i]->byval_arg));
819 ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
821 MonoDomain *domain = mono_domain_get ();
822 MonoClass *class = mono_class_from_mono_type (type);
824 info->parent = class->parent ? mono_type_get_object (domain, &class->parent->byval_arg): NULL;
825 info->name = mono_string_new (domain, class->name);
826 info->name_space = mono_string_new (domain, class->name_space);
827 info->attrs = class->flags;
828 info->rank = class->rank;
829 info->assembly = mono_assembly_get_object (domain, class->image->assembly);
830 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
831 info->etype = mono_type_get_object (domain, class->enum_basetype);
832 else if (class->element_class)
833 info->etype = mono_type_get_object (domain, &class->element_class->byval_arg);
837 info->isbyref = type->byref;
838 info->ispointer = type->type == MONO_TYPE_PTR;
839 info->isprimitive = (type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8);
843 ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params)
845 return mono_runtime_invoke_array (method->method, this, params);
849 ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs)
851 MonoDomain *domain = mono_domain_get ();
852 MonoMethod *m = method->method;
853 MonoMethodSignature *sig = m->signature;
856 int i, j, outarg_count = 0;
858 if (m->klass == mono_defaults.object_class) {
860 if (!strcmp (m->name, "FieldGetter")) {
861 MonoClass *k = this->vtable->klass;
862 MonoString *name = mono_array_get (params, MonoString *, 1);
865 str = mono_string_to_utf8 (name);
867 for (i = 0; i < k->field.count; i++) {
868 if (!strcmp (k->fields [i].name, str)) {
869 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
870 if (field_klass->valuetype)
871 result = mono_value_box (domain, field_klass,
872 (char *)this + k->fields [i].offset);
874 result = *((gpointer *)((char *)this + k->fields [i].offset));
877 out_args = mono_array_new (domain, mono_defaults.object_class, 1);
879 mono_array_set (out_args, gpointer, 0, result);
886 g_assert_not_reached ();
888 } else if (!strcmp (m->name, "FieldSetter")) {
889 MonoClass *k = this->vtable->klass;
890 MonoString *name = mono_array_get (params, MonoString *, 1);
894 str = mono_string_to_utf8 (name);
896 for (i = 0; i < k->field.count; i++) {
897 if (!strcmp (k->fields [i].name, str)) {
898 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
899 MonoObject *val = mono_array_get (params, gpointer, 2);
901 if (field_klass->valuetype) {
902 size = mono_type_size (k->fields [i].type, &align);
903 memcpy ((char *)this + k->fields [i].offset,
904 ((char *)val) + sizeof (MonoObject), size);
906 *((gpointer *)this + k->fields [i].offset) = val;
915 g_assert_not_reached ();
920 for (i = 0; i < params->bounds->length; i++) {
921 if (sig->params [i]->byref)
925 out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
927 for (i = 0, j = 0; i < params->bounds->length; i++) {
928 if (sig->params [i]->byref) {
930 arg = mono_array_get (params, gpointer, i);
931 mono_array_set (out_args, gpointer, j, arg);
936 /* fixme: handle constructors? */
937 if (!strcmp (method->method->name, ".ctor"))
938 g_assert_not_reached ();
940 result = mono_runtime_invoke_array (method->method, this, params);
948 ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
950 MonoDomain *domain = mono_domain_get ();
951 MonoClass *enumc, *objc;
955 MONO_CHECK_ARG_NULL (type);
956 MONO_CHECK_ARG_NULL (obj);
958 enumc = mono_class_from_mono_type (type->type);
959 objc = obj->vtable->klass;
961 MONO_CHECK_ARG (obj, enumc->enumtype == TRUE);
962 MONO_CHECK_ARG (obj, (objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 &&
963 objc->byval_arg.type <= MONO_TYPE_U8));
965 s1 = mono_class_value_size (enumc, NULL);
966 s2 = mono_class_value_size (objc, NULL);
968 res = mono_object_new (domain, enumc);
970 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
971 memcpy ((char *)res + sizeof (MonoObject), (char *)obj + sizeof (MonoObject), MIN (s1, s2));
973 memcpy ((char *)res + sizeof (MonoObject) + (s1 > s2 ? s1 - s2 : 0),
974 (char *)obj + sizeof (MonoObject) + (s2 > s1 ? s2 - s1 : 0),
981 ves_icall_System_Enum_get_value (MonoObject *this)
983 MonoDomain *domain = mono_domain_get ();
993 g_assert (this->vtable->klass->enumtype);
995 enumc = mono_class_from_mono_type (this->vtable->klass->enum_basetype);
996 res = mono_object_new (domain, enumc);
997 dst = (char *)res + sizeof (MonoObject);
998 src = (char *)this + sizeof (MonoObject);
999 size = mono_class_value_size (enumc, NULL);
1001 memcpy (dst, src, size);
1007 ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
1009 MonoDomain *domain = mono_domain_get ();
1010 MonoClass *enumc = mono_class_from_mono_type (type->type);
1011 guint i, j, nvalues, crow;
1012 MonoClassField *field;
1014 info->utype = mono_type_get_object (domain, enumc->enum_basetype);
1015 nvalues = enumc->field.count - 1;
1016 info->names = mono_array_new (domain, mono_defaults.string_class, nvalues);
1017 info->values = mono_array_new (domain, enumc, nvalues);
1019 for (i = 0, j = 0; i < enumc->field.count; ++i) {
1020 field = &enumc->fields [i];
1021 if (strcmp ("value__", field->name) == 0)
1023 mono_array_set (info->names, gpointer, j, mono_string_new (domain, field->name));
1025 crow = mono_metadata_get_constant_index (enumc->image, MONO_TOKEN_FIELD_DEF | (i+enumc->field.first+1));
1026 crow = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_VALUE);
1027 /* 1 is the length of the blob */
1028 field->data = 1 + mono_metadata_blob_heap (enumc->image, crow);
1030 switch (enumc->enum_basetype->type) {
1033 mono_array_set (info->values, gchar, j, *field->data);
1035 case MONO_TYPE_CHAR:
1038 mono_array_set (info->values, gint16, j, read16 (field->data));
1042 mono_array_set (info->values, gint32, j, read32 (field->data));
1046 mono_array_set (info->values, gint64, j, read64 (field->data));
1049 g_error ("Implement type 0x%02x in get_enum_info", enumc->enum_basetype->type);
1056 search_method (MonoReflectionType *type, const char *name, guint32 flags, MonoArray *args)
1058 MonoClass *klass, *start_class;
1060 MonoReflectionType *paramt;
1063 start_class = klass = mono_class_from_mono_type (type->type);
1065 for (i = 0; i < klass->method.count; ++i) {
1066 m = klass->methods [i];
1067 if (!((m->flags & flags) == flags))
1069 if (strcmp(m->name, name))
1071 if (m->signature->param_count != mono_array_length (args))
1073 for (j = 0; j < m->signature->param_count; ++j) {
1074 paramt = mono_array_get (args, MonoReflectionType*, j);
1075 if (!mono_metadata_type_equal (paramt->type, m->signature->params [j]))
1078 if (j == m->signature->param_count)
1081 klass = klass->parent;
1083 g_print ("Method %s.%s::%s (%d) not found\n", start_class->name_space, start_class->name, name, mono_array_length (args));
1087 static MonoReflectionMethod*
1088 ves_icall_get_constructor (MonoReflectionType *type, MonoArray *args)
1090 MonoDomain *domain = mono_domain_get ();
1093 m = search_method (type, ".ctor", METHOD_ATTRIBUTE_RT_SPECIAL_NAME, args);
1095 return mono_method_get_object (domain, m);
1099 static MonoReflectionMethod*
1100 ves_icall_get_method (MonoReflectionType *type, MonoString *name, MonoArray *args)
1102 MonoDomain *domain = mono_domain_get ();
1104 char *n = mono_string_to_utf8 (name);
1106 m = search_method (type, n, 0, args);
1109 return mono_method_get_object (domain, m);
1113 static MonoProperty*
1114 search_property (MonoClass *klass, char* name, MonoArray *args) {
1118 /* FIXME: handle args */
1119 for (i = 0; i < klass->property.count; ++i) {
1120 p = &klass->properties [i];
1121 if (strcmp (p->name, name) == 0)
1127 static MonoReflectionProperty*
1128 ves_icall_get_property (MonoReflectionType *type, MonoString *name, MonoArray *args)
1130 MonoDomain *domain = mono_domain_get ();
1132 MonoClass *class = mono_class_from_mono_type (type->type);
1133 char *n = mono_string_to_utf8 (name);
1135 p = search_property (class, n, args);
1138 return mono_property_get_object (domain, class, p);
1143 BFLAGS_IgnoreCase = 1,
1144 BFLAGS_DeclaredOnly = 2,
1145 BFLAGS_Instance = 4,
1147 BFLAGS_Public = 0x10,
1148 BFLAGS_NonPublic = 0x20,
1149 BFLAGS_InvokeMethod = 0x100,
1150 BFLAGS_CreateInstance = 0x200,
1151 BFLAGS_GetField = 0x400,
1152 BFLAGS_SetField = 0x800,
1153 BFLAGS_GetProperty = 0x1000,
1154 BFLAGS_SetProperty = 0x2000,
1155 BFLAGS_ExactBinding = 0x10000,
1156 BFLAGS_SuppressChangeType = 0x20000,
1157 BFLAGS_OptionalParamBinding = 0x40000
1161 ves_icall_Type_GetFields (MonoReflectionType *type, guint32 bflags)
1164 GSList *l = NULL, *tmp;
1165 static MonoClass *System_Reflection_FieldInfo;
1166 MonoClass *startklass, *klass;
1170 MonoClassField *field;
1172 domain = ((MonoObject *)type)->vtable->domain;
1173 klass = startklass = mono_class_from_mono_type (type->type);
1176 for (i = 0; i < klass->field.count; ++i) {
1178 field = &klass->fields [i];
1179 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
1180 if (bflags & BFLAGS_Public)
1183 if (bflags & BFLAGS_NonPublic)
1189 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1190 if (bflags & BFLAGS_Static)
1193 if (bflags & BFLAGS_Instance)
1199 member = (MonoObject*)mono_field_get_object (domain, klass, field);
1200 l = g_slist_prepend (l, member);
1202 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1204 len = g_slist_length (l);
1205 if (!System_Reflection_FieldInfo)
1206 System_Reflection_FieldInfo = mono_class_from_name (
1207 mono_defaults.corlib, "System.Reflection", "FieldInfo");
1208 res = mono_array_new (domain, System_Reflection_FieldInfo, len);
1210 tmp = g_slist_reverse (l);
1211 for (; tmp; tmp = tmp->next, ++i)
1212 mono_array_set (res, gpointer, i, tmp->data);
1218 ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
1221 GSList *l = NULL, *tmp;
1222 static MonoClass *System_Reflection_MethodInfo;
1223 MonoClass *startklass, *klass;
1229 domain = ((MonoObject *)type)->vtable->domain;
1230 klass = startklass = mono_class_from_mono_type (type->type);
1233 for (i = 0; i < klass->method.count; ++i) {
1235 method = klass->methods [i];
1236 if (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)
1238 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1239 if (bflags & BFLAGS_Public)
1242 if (bflags & BFLAGS_NonPublic)
1248 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1249 if (bflags & BFLAGS_Static)
1252 if (bflags & BFLAGS_Instance)
1259 member = (MonoObject*)mono_method_get_object (domain, method);
1261 l = g_slist_prepend (l, member);
1263 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1265 len = g_slist_length (l);
1266 if (!System_Reflection_MethodInfo)
1267 System_Reflection_MethodInfo = mono_class_from_name (
1268 mono_defaults.corlib, "System.Reflection", "MethodInfo");
1269 res = mono_array_new (domain, System_Reflection_MethodInfo, len);
1272 for (; tmp; tmp = tmp->next, ++i)
1273 mono_array_set (res, gpointer, i, tmp->data);
1279 ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
1282 GSList *l = NULL, *tmp;
1283 static MonoClass *System_Reflection_ConstructorInfo;
1284 MonoClass *startklass, *klass;
1290 domain = ((MonoObject *)type)->vtable->domain;
1291 klass = startklass = mono_class_from_mono_type (type->type);
1294 for (i = 0; i < klass->method.count; ++i) {
1296 method = klass->methods [i];
1297 if (strcmp (method->name, ".ctor") && strcmp (method->name, ".cctor"))
1299 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1300 if (bflags & BFLAGS_Public)
1303 if (bflags & BFLAGS_NonPublic)
1309 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1310 if (bflags & BFLAGS_Static)
1313 if (bflags & BFLAGS_Instance)
1319 member = (MonoObject*)mono_method_get_object (domain, method);
1321 l = g_slist_prepend (l, member);
1323 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1325 len = g_slist_length (l);
1326 if (!System_Reflection_ConstructorInfo)
1327 System_Reflection_ConstructorInfo = mono_class_from_name (
1328 mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
1329 res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
1332 for (; tmp; tmp = tmp->next, ++i)
1333 mono_array_set (res, gpointer, i, tmp->data);
1339 ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
1342 GSList *l = NULL, *tmp;
1343 static MonoClass *System_Reflection_PropertyInfo;
1344 MonoClass *startklass, *klass;
1350 domain = ((MonoObject *)type)->vtable->domain;
1351 klass = startklass = mono_class_from_mono_type (type->type);
1354 for (i = 0; i < klass->property.count; ++i) {
1355 prop = &klass->properties [i];
1360 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1361 if (bflags & BFLAGS_Public)
1364 if (bflags & BFLAGS_NonPublic)
1370 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1371 if (bflags & BFLAGS_Static)
1374 if (bflags & BFLAGS_Instance)
1381 l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
1383 if (!l && (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
1385 len = g_slist_length (l);
1386 if (!System_Reflection_PropertyInfo)
1387 System_Reflection_PropertyInfo = mono_class_from_name (
1388 mono_defaults.corlib, "System.Reflection", "PropertyInfo");
1389 res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
1392 for (; tmp; tmp = tmp->next, ++i)
1393 mono_array_set (res, gpointer, i, tmp->data);
1399 ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
1402 GSList *l = NULL, *tmp;
1403 static MonoClass *System_Reflection_EventInfo;
1404 MonoClass *startklass, *klass;
1410 domain = ((MonoObject *)type)->vtable->domain;
1411 klass = startklass = mono_class_from_mono_type (type->type);
1414 for (i = 0; i < klass->event.count; ++i) {
1415 event = &klass->events [i];
1417 method = event->add;
1419 method = event->remove;
1420 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1421 if (bflags & BFLAGS_Public)
1424 if (bflags & BFLAGS_NonPublic)
1430 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1431 if (bflags & BFLAGS_Static)
1434 if (bflags & BFLAGS_Instance)
1441 l = g_slist_prepend (l, mono_event_get_object (domain, klass, event));
1443 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1445 len = g_slist_length (l);
1446 if (!System_Reflection_EventInfo)
1447 System_Reflection_EventInfo = mono_class_from_name (
1448 mono_defaults.corlib, "System.Reflection", "EventInfo");
1449 res = mono_array_new (domain, System_Reflection_EventInfo, len);
1452 for (; tmp; tmp = tmp->next, ++i)
1453 mono_array_set (res, gpointer, i, tmp->data);
1459 ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
1462 GSList *l = NULL, *tmp;
1464 MonoClass *startklass, *klass;
1470 domain = ((MonoObject *)type)->vtable->domain;
1471 klass = startklass = mono_class_from_mono_type (type->type);
1473 for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
1475 nested = tmpn->data;
1476 if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
1477 if (bflags & BFLAGS_Public)
1480 if (bflags & BFLAGS_NonPublic)
1485 member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
1486 l = g_slist_prepend (l, member);
1488 len = g_slist_length (l);
1489 res = mono_array_new (domain, mono_defaults.monotype_class, len);
1491 tmp = g_slist_reverse (l);
1492 for (; tmp; tmp = tmp->next, ++i)
1493 mono_array_set (res, gpointer, i, tmp->data);
1499 ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr (gpointer ptr)
1501 return (gpointer)(*(int *)ptr);
1505 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAuto (gpointer ptr)
1507 MonoDomain *domain = mono_domain_get ();
1509 return mono_string_new (domain, (char *)ptr);
1512 static guint32 ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error(void)
1514 return(GetLastError());
1517 static MonoReflectionType*
1518 ves_icall_System_Reflection_Assembly_GetType (MonoReflectionAssembly *assembly, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
1520 MonoDomain *domain = mono_domain_get ();
1523 MonoTypeNameParse info;
1525 str = mono_string_to_utf8 (name);
1526 /*g_print ("requested type %s in %s\n", str, assembly->assembly->name);*/
1527 if (!mono_reflection_parse_type (str, &info)) {
1529 g_list_free (info.modifiers);
1530 if (throwOnError) /* uhm: this is a parse error, though... */
1531 mono_raise_exception (mono_get_exception_type_load ());
1535 type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
1537 g_list_free (info.modifiers);
1540 mono_raise_exception (mono_get_exception_type_load ());
1543 /*g_print ("got it\n");*/
1544 return mono_type_get_object (domain, type);
1549 ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *assembly)
1551 MonoDomain *domain = mono_domain_get ();
1553 char *name = g_strconcat (
1554 "file://", assembly->assembly->image->name, NULL);
1556 res = mono_string_new (domain, name);
1562 ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
1564 MonoDomain *domain = mono_domain_get ();
1568 name = mono_type_get_name (object->type);
1569 res = mono_string_new (domain, name);
1576 ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
1578 MonoDomain *domain = mono_domain_get ();
1581 MonoTableInfo *tdef = &assembly->assembly->image->tables [MONO_TABLE_TYPEDEF];
1583 guint32 attrs, visibility;
1587 for (i = 0; i < tdef->rows; ++i) {
1588 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
1589 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
1590 if (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)
1596 res = mono_array_new (domain, mono_defaults.monotype_class, count);
1598 for (i = 0; i < tdef->rows; ++i) {
1599 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
1600 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
1601 if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
1602 klass = mono_class_get (assembly->assembly->image, (i + 1) | MONO_TOKEN_TYPE_DEF);
1603 mono_array_set (res, gpointer, count, mono_type_get_object (domain, &klass->byval_arg));
1611 static MonoReflectionType*
1612 ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
1615 int isbyref = 0, rank;
1616 char *str = mono_string_to_utf8 (smodifiers);
1619 klass = mono_class_from_mono_type (tb->type.type);
1621 /* logic taken from mono_reflection_parse_type(): keep in sync */
1625 if (isbyref) /* only one level allowed by the spec */
1629 return mono_type_get_object (mono_domain_get (), &klass->this_arg);
1632 klass = mono_ptr_class_get (&klass->byval_arg);
1633 mono_class_init (klass);
1644 else if (*p != '*') /* '*' means unknown lower bound */
1651 klass = mono_array_class_get (&klass->byval_arg, rank);
1652 mono_class_init (klass);
1659 return mono_type_get_object (mono_domain_get (), &klass->byval_arg);
1663 * Magic number to convert a time which is relative to
1664 * Jan 1, 1970 into a value which is relative to Jan 1, 0001.
1666 #define EPOCH_ADJUST ((gint64)62135596800L)
1669 ves_icall_System_DateTime_GetNow (void)
1671 #ifndef PLATFORM_WIN32
1672 /* FIXME: put this in io-layer and call it GetLocalTime */
1676 if (gettimeofday (&tv, NULL) == 0) {
1677 res = (((gint64)tv.tv_sec + EPOCH_ADJUST)* 1000000 + tv.tv_usec)*10;
1681 /* fixme: raise exception */
1687 * This is heavily based on zdump.c from glibc 2.2.
1689 * * data[0]: start of daylight saving time (in DateTime ticks).
1690 * * data[1]: end of daylight saving time (in DateTime ticks).
1691 * * data[2]: utcoffset (in TimeSpan ticks).
1692 * * data[3]: additional offset when daylight saving (in TimeSpan ticks).
1693 * * name[0]: name of this timezone when not daylight saving.
1694 * * name[1]: name of this timezone when daylight saving.
1696 * FIXME: This only works with "standard" Unix dates (years between 1900 and 2100) while
1697 * the class library allows years between 1 and 9999.
1699 * Returns true on success and zero on failure.
1702 ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
1704 #ifndef PLATFORM_WIN32
1705 MonoDomain *domain = mono_domain_get ();
1706 struct tm start, tt;
1710 int is_daylight = 0, day;
1712 memset (&start, 0, sizeof (start));
1715 start.tm_year = year-1900;
1717 t = mktime (&start);
1718 gmtoff = start.tm_gmtoff;
1720 MONO_CHECK_ARG_NULL (data);
1721 MONO_CHECK_ARG_NULL (names);
1723 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
1724 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
1726 /* For each day of the year, calculate the tm_gmtoff. */
1727 for (day = 0; day < 365; day++) {
1730 tt = *localtime (&t);
1732 /* Daylight saving starts or ends here. */
1733 if (tt.tm_gmtoff != gmtoff) {
1737 /* Try to find the exact hour when daylight saving starts/ends. */
1741 tt1 = *localtime (&t1);
1742 } while (tt1.tm_gmtoff != gmtoff);
1744 /* Try to find the exact minute when daylight saving starts/ends. */
1747 tt1 = *localtime (&t1);
1748 } while (tt1.tm_gmtoff == gmtoff);
1750 /* Write data, if we're already in daylight saving, we're done. */
1752 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tt.tm_zone));
1753 mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
1756 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tt.tm_zone));
1757 mono_array_set ((*data), gint64, 0, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
1761 /* This is only set once when we enter daylight saving. */
1762 mono_array_set ((*data), gint64, 2, (gint64)gmtoff * 10000000L);
1763 mono_array_set ((*data), gint64, 3, (gint64)(tt.tm_gmtoff - gmtoff) * 10000000L);
1765 gmtoff = tt.tm_gmtoff;
1768 gmtoff = tt.tm_gmtoff;
1775 ves_icall_System_Object_obj_address (MonoObject *this) {
1782 ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array) {
1788 klass = array->obj.vtable->klass;
1789 etype = klass->element_class->byval_arg.type;
1790 if (etype < MONO_TYPE_BOOLEAN || etype > MONO_TYPE_R8)
1794 for (i = 0; i < klass->rank; ++ i)
1795 length += array->bounds [i].length;
1797 esize = mono_array_element_size (klass);
1798 return length * esize;
1802 ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx) {
1803 return mono_array_get (array, gint8, idx);
1807 ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value) {
1808 mono_array_set (array, gint8, idx, value);
1812 ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count) {
1813 char *src_buf, *dest_buf;
1815 src_buf = (gint8 *)src->vector + src_offset;
1816 dest_buf = (gint8 *)dest->vector + dest_offset;
1818 memcpy (dest_buf, src_buf, count);
1822 ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
1824 MonoDomain *domain = mono_domain_get ();
1826 MonoRealProxy *rp = ((MonoRealProxy *)this);
1830 res = mono_object_new (domain, mono_defaults.transparent_proxy_class);
1832 ((MonoTransparentProxy *)res)->rp = rp;
1833 type = ((MonoReflectionType *)rp->class_to_proxy)->type;
1834 klass = mono_class_from_mono_type (type);
1836 res->vtable = mono_class_proxy_vtable (domain, klass);
1841 /* System.Environment */
1844 ves_icall_System_Environment_get_MachineName (void)
1846 #if defined (PLATFORM_WIN32)
1851 len = MAX_COMPUTERNAME_LENGTH + 1;
1852 buf = g_new (gunichar2, len);
1855 if (GetComputerName (buf, &len))
1856 result = mono_string_new_utf16 (mono_domain_get (), buf, len);
1866 buf = g_new (gchar, len);
1869 if (gethostname (buf, len) != 0)
1870 result = mono_string_new (mono_domain_get (), buf);
1878 ves_icall_System_Environment_get_NewLine (void)
1880 #if defined (PLATFORM_WIN32)
1881 return mono_string_new (mono_domain_get (), "\r\n");
1883 return mono_string_new (mono_domain_get (), "\n");
1888 ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
1896 utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
1897 value = g_getenv (utf8_name);
1903 return mono_string_new (mono_domain_get (), value);
1907 ves_icall_System_Environment_GetEnvironmentVariableNames (void)
1916 for (e = environ; *e != 0; ++ e)
1919 domain = mono_domain_get ();
1920 names = mono_array_new (domain, mono_defaults.string_class, n);
1923 for (e = environ; *e != 0; ++ e) {
1924 parts = g_strsplit (*e, "=", 2);
1926 str = mono_string_new (domain, *parts);
1927 mono_array_set (names, MonoString *, n, str);
1939 ves_icall_System_Environment_GetCommandLine (void)
1941 return NULL; /* FIXME */
1945 ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this,
1946 MonoReflectionMethod *method,
1947 MonoArray *out_args)
1949 MonoDomain *domain = mono_domain_get ();
1951 mono_message_init (domain, this, method, out_args);
1955 ves_icall_IsTransparentProxy (MonoObject *proxy)
1960 if (proxy->vtable->klass == mono_defaults.transparent_proxy_class)
1968 static gconstpointer icall_map [] = {
1972 "System.Array::GetValue", ves_icall_System_Array_GetValue,
1973 "System.Array::SetValue", ves_icall_System_Array_SetValue,
1974 "System.Array::GetValueImpl", ves_icall_System_Array_GetValueImpl,
1975 "System.Array::SetValueImpl", ves_icall_System_Array_SetValueImpl,
1976 "System.Array::GetRank", ves_icall_System_Array_GetRank,
1977 "System.Array::GetLength", ves_icall_System_Array_GetLength,
1978 "System.Array::GetLowerBound", ves_icall_System_Array_GetLowerBound,
1979 "System.Array::CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl,
1980 "System.Array::FastCopy", ves_icall_System_Array_FastCopy,
1981 "System.Array::Clone", mono_array_clone,
1986 "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone,
1987 "System.Object::GetType", ves_icall_System_Object_GetType,
1988 "System.Object::GetHashCode", ves_icall_System_Object_GetHashCode,
1989 "System.Object::obj_address", ves_icall_System_Object_obj_address,
1994 "System.ValueType::GetHashCode", ves_icall_System_ValueType_GetHashCode,
1999 "System.String::_IsInterned", mono_string_is_interned,
2000 "System.String::_Intern", mono_string_intern,
2005 "System.AppDomain::createDomain", ves_icall_System_AppDomain_createDomain,
2006 "System.AppDomain::getCurDomain", ves_icall_System_AppDomain_getCurDomain,
2007 "System.AppDomain::GetData", ves_icall_System_AppDomain_GetData,
2008 "System.AppDomain::SetData", ves_icall_System_AppDomain_SetData,
2009 "System.AppDomain::getSetup", ves_icall_System_AppDomain_getSetup,
2010 "System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
2011 "System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
2012 "System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
2013 "System.AppDomain::Unload", ves_icall_System_AppDomain_Unload,
2014 "System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
2017 * System.AppDomainSetup
2019 "System.AppDomainSetup::InitAppDomainSetup", ves_icall_System_AppDomainSetup_InitAppDomainSetup,
2024 "System.Decimal::decimal2UInt64", mono_decimal2UInt64,
2025 "System.Decimal::decimal2Int64", mono_decimal2Int64,
2026 "System.Decimal::double2decimal", mono_double2decimal, /* FIXME: wrong signature. */
2027 "System.Decimal::decimalIncr", mono_decimalIncr,
2028 "System.Decimal::decimalSetExponent", mono_decimalSetExponent,
2029 "System.Decimal::decimal2double", mono_decimal2double,
2030 "System.Decimal::decimalFloorAndTrunc", mono_decimalFloorAndTrunc,
2031 "System.Decimal::decimalRound", mono_decimalRound,
2032 "System.Decimal::decimalMult", mono_decimalMult,
2033 "System.Decimal::decimalDiv", mono_decimalDiv,
2034 "System.Decimal::decimalIntDiv", mono_decimalIntDiv,
2035 "System.Decimal::decimalCompare", mono_decimalCompare,
2036 "System.Decimal::string2decimal", mono_string2decimal,
2037 "System.Decimal::decimal2string", mono_decimal2string,
2042 "System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
2047 "System.Reflection.Emit.AssemblyBuilder::getDataChunk", ves_icall_AssemblyBuilder_getDataChunk,
2048 "System.Reflection.Emit.AssemblyBuilder::getPEHeader", ves_icall_AssemblyBuilder_getPEHeader,
2049 "System.Reflection.Emit.AssemblyBuilder::getUSIndex", mono_image_insert_string,
2050 "System.Reflection.Emit.AssemblyBuilder::getToken", ves_icall_AssemblyBuilder_getToken,
2051 "System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
2056 "System.Reflection.MonoMethodInfo::get_method_info", ves_icall_get_method_info,
2057 "System.Reflection.MonoMethodInfo::get_parameter_info", ves_icall_get_parameter_info,
2058 "System.Reflection.MonoFieldInfo::get_field_info", ves_icall_get_field_info,
2059 "System.Reflection.MonoPropertyInfo::get_property_info", ves_icall_get_property_info,
2060 "System.Reflection.MonoMethod::InternalInvoke", ves_icall_InternalInvoke,
2061 "System.Reflection.MonoCMethod::InternalInvoke", ves_icall_InternalInvoke,
2062 "System.MonoCustomAttrs::GetCustomAttributes", mono_reflection_get_custom_attrs,
2063 "System.Reflection.Emit.CustomAttributeBuilder::GetBlob", mono_reflection_get_custom_attrs_blob,
2064 "System.Reflection.MonoField::GetValue", ves_icall_MonoField_GetValue,
2065 "System.Reflection.Emit.SignatureHelper::get_signature_local", mono_reflection_sighelper_get_signature_local,
2066 "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
2071 "System.MonoEnumInfo::get_enum_info", ves_icall_get_enum_info,
2072 "System.Enum::get_value", ves_icall_System_Enum_get_value,
2073 "System.Enum::ToObject", ves_icall_System_Enum_ToObject,
2078 "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
2088 "System.Type::internal_from_name", ves_icall_type_from_name,
2089 "System.Type::internal_from_handle", ves_icall_type_from_handle,
2090 "System.Type::get_constructor", ves_icall_get_constructor,
2091 "System.Type::get_property", ves_icall_get_property,
2092 "System.Type::get_method", ves_icall_get_method,
2093 "System.MonoType::get_attributes", ves_icall_get_attributes,
2094 "System.Type::type_is_subtype_of", ves_icall_type_is_subtype_of,
2095 "System.Type::Equals", ves_icall_type_Equals,
2098 * System.Runtime.CompilerServices.RuntimeHelpers
2100 "System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray", ves_icall_InitializeArray,
2105 "System.Threading.Thread::Thread_internal", ves_icall_System_Threading_Thread_Thread_internal,
2106 "System.Threading.Thread::Start_internal", ves_icall_System_Threading_Thread_Start_internal,
2107 "System.Threading.Thread::Sleep_internal", ves_icall_System_Threading_Thread_Sleep_internal,
2108 "System.Threading.Thread::CurrentThread_internal", ves_icall_System_Threading_Thread_CurrentThread_internal,
2109 "System.Threading.Thread::Join_internal", ves_icall_System_Threading_Thread_Join_internal,
2110 "System.Threading.Thread::SlotHash_lookup", ves_icall_System_Threading_Thread_SlotHash_lookup,
2111 "System.Threading.Thread::SlotHash_store", ves_icall_System_Threading_Thread_SlotHash_store,
2112 "System.Threading.Monitor::Monitor_exit", ves_icall_System_Threading_Monitor_Monitor_exit,
2113 "System.Threading.Monitor::Monitor_test_owner", ves_icall_System_Threading_Monitor_Monitor_test_owner,
2114 "System.Threading.Monitor::Monitor_test_synchronised", ves_icall_System_Threading_Monitor_Monitor_test_synchronised,
2115 "System.Threading.Monitor::Monitor_pulse", ves_icall_System_Threading_Monitor_Monitor_pulse,
2116 "System.Threading.Monitor::Monitor_pulse_all", ves_icall_System_Threading_Monitor_Monitor_pulse_all,
2117 "System.Threading.Monitor::Monitor_try_enter", ves_icall_System_Threading_Monitor_Monitor_try_enter,
2118 "System.Threading.Monitor::Monitor_wait", ves_icall_System_Threading_Monitor_Monitor_wait,
2119 "System.Threading.Mutex::CreateMutex_internal", ves_icall_System_Threading_Mutex_CreateMutex_internal,
2120 "System.Threading.Mutex::ReleaseMutex_internal", ves_icall_System_Threading_Mutex_ReleaseMutex_internal,
2121 "System.Threading.NativeEventCalls::CreateEvent_internal", ves_icall_System_Threading_Events_CreateEvent_internal,
2122 "System.Threading.NativeEventCalls::SetEvent_internal", ves_icall_System_Threading_Events_SetEvent_internal,
2123 "System.Threading.NativeEventCalls::ResetEvent_internal", ves_icall_System_Threading_Events_ResetEvent_internal,
2126 * System.Threading.WaitHandle
2128 "System.Threading.WaitHandle::WaitAll_internal", ves_icall_System_Threading_WaitHandle_WaitAll_internal,
2129 "System.Threading.WaitHandle::WaitAny_internal", ves_icall_System_Threading_WaitHandle_WaitAny_internal,
2130 "System.Threading.WaitHandle::WaitOne_internal", ves_icall_System_Threading_WaitHandle_WaitOne_internal,
2132 "System.Runtime.InteropServices.Marshal::ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr,
2133 "System.Runtime.InteropServices.Marshal::PtrToStringAuto", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAuto,
2134 "System.Runtime.InteropServices.Marshal::GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error,
2136 "System.Reflection.Assembly::GetType", ves_icall_System_Reflection_Assembly_GetType,
2137 "System.Reflection.Assembly::GetTypes", ves_icall_System_Reflection_Assembly_GetTypes,
2138 "System.Reflection.Assembly::get_code_base", ves_icall_System_Reflection_Assembly_get_code_base,
2143 "System.MonoType::getFullName", ves_icall_System_MonoType_getFullName,
2144 "System.MonoType::type_from_obj", mono_type_type_from_obj,
2145 "System.MonoType::get_type_info", ves_icall_get_type_info,
2146 "System.MonoType::GetFields", ves_icall_Type_GetFields,
2147 "System.MonoType::GetMethods", ves_icall_Type_GetMethods,
2148 "System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
2149 "System.MonoType::GetProperties", ves_icall_Type_GetProperties,
2150 "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
2151 "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
2152 "System.MonoType::GetNestedTypes", ves_icall_Type_GetNestedTypes,
2155 * System.Net.Sockets I/O Services
2157 "System.Net.Sockets.Socket::Socket_internal", ves_icall_System_Net_Sockets_Socket_Socket_internal,
2158 "System.Net.Sockets.Socket::Close_internal", ves_icall_System_Net_Sockets_Socket_Close_internal,
2159 "System.Net.Sockets.SocketException::WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal,
2160 "System.Net.Sockets.Socket::Available_internal", ves_icall_System_Net_Sockets_Socket_Available_internal,
2161 "System.Net.Sockets.Socket::Blocking_internal", ves_icall_System_Net_Sockets_Socket_Blocking_internal,
2162 "System.Net.Sockets.Socket::Accept_internal", ves_icall_System_Net_Sockets_Socket_Accept_internal,
2163 "System.Net.Sockets.Socket::Listen_internal", ves_icall_System_Net_Sockets_Socket_Listen_internal,
2164 "System.Net.Sockets.Socket::LocalEndPoint_internal", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal,
2165 "System.Net.Sockets.Socket::RemoteEndPoint_internal", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal,
2166 "System.Net.Sockets.Socket::Bind_internal", ves_icall_System_Net_Sockets_Socket_Bind_internal,
2167 "System.Net.Sockets.Socket::Connect_internal", ves_icall_System_Net_Sockets_Socket_Connect_internal,
2168 "System.Net.Sockets.Socket::Receive_internal", ves_icall_System_Net_Sockets_Socket_Receive_internal,
2169 "System.Net.Sockets.Socket::RecvFrom_internal", ves_icall_System_Net_Sockets_Socket_RecvFrom_internal,
2170 "System.Net.Sockets.Socket::Send_internal", ves_icall_System_Net_Sockets_Socket_Send_internal,
2171 "System.Net.Sockets.Socket::SendTo_internal", ves_icall_System_Net_Sockets_Socket_SendTo_internal,
2172 "System.Net.Sockets.Socket::Select_internal", ves_icall_System_Net_Sockets_Socket_Select_internal,
2173 "System.Net.Sockets.Socket::Shutdown_internal", ves_icall_System_Net_Sockets_Socket_Shutdown_internal,
2174 "System.Net.Sockets.Socket::GetSocketOption_obj_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal,
2175 "System.Net.Sockets.Socket::GetSocketOption_arr_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal,
2176 "System.Net.Sockets.Socket::SetSocketOption_internal", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal,
2177 "System.Net.Dns::GetHostByName_internal", ves_icall_System_Net_Dns_GetHostByName_internal,
2178 "System.Net.Dns::GetHostByAddr_internal", ves_icall_System_Net_Dns_GetHostByAddr_internal,
2183 "System.Char::GetNumericValue", ves_icall_System_Char_GetNumericValue,
2184 "System.Char::GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory,
2185 "System.Char::IsControl", ves_icall_System_Char_IsControl,
2186 "System.Char::IsDigit", ves_icall_System_Char_IsDigit,
2187 "System.Char::IsLetter", ves_icall_System_Char_IsLetter,
2188 "System.Char::IsLower", ves_icall_System_Char_IsLower,
2189 "System.Char::IsUpper", ves_icall_System_Char_IsUpper,
2190 "System.Char::IsNumber", ves_icall_System_Char_IsNumber,
2191 "System.Char::IsPunctuation", ves_icall_System_Char_IsPunctuation,
2192 "System.Char::IsSeparator", ves_icall_System_Char_IsSeparator,
2193 "System.Char::IsSurrogate", ves_icall_System_Char_IsSurrogate,
2194 "System.Char::IsSymbol", ves_icall_System_Char_IsSymbol,
2195 "System.Char::IsWhiteSpace", ves_icall_System_Char_IsWhiteSpace,
2196 "System.Char::ToLower", ves_icall_System_Char_ToLower,
2197 "System.Char::ToUpper", ves_icall_System_Char_ToUpper,
2199 "System.Text.Encoding::IConvNewEncoder", ves_icall_iconv_new_encoder,
2200 "System.Text.Encoding::IConvNewDecoder", ves_icall_iconv_new_decoder,
2201 "System.Text.Encoding::IConvReset", ves_icall_iconv_reset,
2202 "System.Text.Encoding::IConvGetByteCount", ves_icall_iconv_get_byte_count,
2203 "System.Text.Encoding::IConvGetBytes", ves_icall_iconv_get_bytes,
2204 "System.Text.Encoding::IConvGetCharCount", ves_icall_iconv_get_char_count,
2205 "System.Text.Encoding::IConvGetChars", ves_icall_iconv_get_chars,
2207 "System.DateTime::GetNow", ves_icall_System_DateTime_GetNow,
2208 "System.CurrentTimeZone::GetTimeZoneData", ves_icall_System_CurrentTimeZone_GetTimeZoneData,
2211 * System.Security.Cryptography calls
2214 "System.Security.Cryptography.RNGCryptoServiceProvider::GetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes,
2215 "System.Security.Cryptography.RNG_CryptoServiceProvider::GetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes,
2220 "System.Buffer::ByteLengthInternal", ves_icall_System_Buffer_ByteLengthInternal,
2221 "System.Buffer::GetByteInternal", ves_icall_System_Buffer_GetByteInternal,
2222 "System.Buffer::SetByteInternal", ves_icall_System_Buffer_SetByteInternal,
2223 "System.Buffer::BlockCopyInternal", ves_icall_System_Buffer_BlockCopyInternal,
2228 "System.IO.MonoIO::GetLastError", ves_icall_System_IO_MonoIO_GetLastError,
2229 "System.IO.MonoIO::CreateDirectory", ves_icall_System_IO_MonoIO_CreateDirectory,
2230 "System.IO.MonoIO::RemoveDirectory", ves_icall_System_IO_MonoIO_RemoveDirectory,
2231 "System.IO.MonoIO::FindFirstFile", ves_icall_System_IO_MonoIO_FindFirstFile,
2232 "System.IO.MonoIO::FindNextFile", ves_icall_System_IO_MonoIO_FindNextFile,
2233 "System.IO.MonoIO::FindClose", ves_icall_System_IO_MonoIO_FindClose,
2234 "System.IO.MonoIO::GetCurrentDirectory", ves_icall_System_IO_MonoIO_GetCurrentDirectory,
2235 "System.IO.MonoIO::SetCurrentDirectory", ves_icall_System_IO_MonoIO_SetCurrentDirectory,
2236 "System.IO.MonoIO::MoveFile", ves_icall_System_IO_MonoIO_MoveFile,
2237 "System.IO.MonoIO::CopyFile", ves_icall_System_IO_MonoIO_CopyFile,
2238 "System.IO.MonoIO::DeleteFile", ves_icall_System_IO_MonoIO_DeleteFile,
2239 "System.IO.MonoIO::GetFileAttributes", ves_icall_System_IO_MonoIO_GetFileAttributes,
2240 "System.IO.MonoIO::SetFileAttributes", ves_icall_System_IO_MonoIO_SetFileAttributes,
2241 "System.IO.MonoIO::GetFileStat", ves_icall_System_IO_MonoIO_GetFileStat,
2242 "System.IO.MonoIO::Open", ves_icall_System_IO_MonoIO_Open,
2243 "System.IO.MonoIO::Close", ves_icall_System_IO_MonoIO_Close,
2244 "System.IO.MonoIO::Read", ves_icall_System_IO_MonoIO_Read,
2245 "System.IO.MonoIO::Write", ves_icall_System_IO_MonoIO_Write,
2246 "System.IO.MonoIO::Seek", ves_icall_System_IO_MonoIO_Seek,
2247 "System.IO.MonoIO::GetLength", ves_icall_System_IO_MonoIO_GetLength,
2248 "System.IO.MonoIO::SetLength", ves_icall_System_IO_MonoIO_SetLength,
2249 "System.IO.MonoIO::SetFileTime", ves_icall_System_IO_MonoIO_SetFileTime,
2250 "System.IO.MonoIO::Flush", ves_icall_System_IO_MonoIO_Flush,
2251 "System.IO.MonoIO::get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput,
2252 "System.IO.MonoIO::get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput,
2253 "System.IO.MonoIO::get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError,
2254 "System.IO.MonoIO::get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar,
2255 "System.IO.MonoIO::get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar,
2256 "System.IO.MonoIO::get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar,
2257 "System.IO.MonoIO::get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator,
2258 "System.IO.MonoIO::get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars,
2263 "System.Math::Sin", ves_icall_System_Math_Sin,
2264 "System.Math::Cos", ves_icall_System_Math_Cos,
2265 "System.Math::Tan", ves_icall_System_Math_Tan,
2266 "System.Math::Sinh", ves_icall_System_Math_Sinh,
2267 "System.Math::Cosh", ves_icall_System_Math_Cosh,
2268 "System.Math::Tanh", ves_icall_System_Math_Tanh,
2269 "System.Math::Acos", ves_icall_System_Math_Acos,
2270 "System.Math::Asin", ves_icall_System_Math_Asin,
2271 "System.Math::Atan", ves_icall_System_Math_Atan,
2272 "System.Math::Atan2", ves_icall_System_Math_Atan2,
2273 "System.Math::Exp", ves_icall_System_Math_Exp,
2274 "System.Math::Log", ves_icall_System_Math_Log,
2275 "System.Math::Log10", ves_icall_System_Math_Log10,
2276 "System.Math::Pow", ves_icall_System_Math_Pow,
2277 "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
2280 * System.Environment
2282 "System.Environment::get_MachineName", ves_icall_System_Environment_get_MachineName,
2283 "System.Environment::get_NewLine", ves_icall_System_Environment_get_NewLine,
2284 "System.Environment::GetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable,
2285 "System.Environment::GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames,
2286 "System.Environment::GetCommandLine", ves_icall_System_Environment_GetCommandLine,
2289 * Mono.CSharp.Debugger
2291 "Mono.CSharp.Debugger.MonoSymbolWriter::get_local_type_from_sig",
2292 ves_icall_Debugger_MonoSymbolWriter_get_local_type_from_sig,
2293 "Mono.CSharp.Debugger.MonoSymbolWriter::get_method",
2294 ves_icall_Debugger_MonoSymbolWriter_method_from_token,
2295 "Mono.CSharp.Debugger.DwarfFileWriter::get_type_token",
2296 ves_icall_Debugger_DwarfFileWriter_get_type_token,
2300 * System.Runtime.Remoting
2302 "System.Runtime.Remoting.RemotingServices::InternalExecute",
2303 ves_icall_InternalExecute,
2304 "System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
2305 ves_icall_IsTransparentProxy,
2308 * System.Runtime.Remoting.Messaging
2310 "System.Runtime.Remoting.Messaging.MonoMethodMessage::InitMessage",
2311 ves_icall_MonoMethodMessage_InitMessage,
2314 * System.Runtime.Remoting.Proxies
2316 "System.Runtime.Remoting.Proxies.RealProxy::GetTransparentProxy",
2317 ves_icall_Remoting_RealProxy_GetTransparentProxy,
2320 * add other internal calls here
2326 mono_init_icall (void)
2331 while ((name = icall_map [i])) {
2332 mono_add_internal_call (name, icall_map [i+1]);