2 * How to map C# types for use in the C implementation of internal calls
14 IntPtr/UIntPtr gpointer
18 For ref and out paramaters you'll use the corresponding pointer type.
19 Arrays of any type must be described with a MonoArray* and the elements
20 must be accessed with the mono_array_* macros.
21 Any other type that has a matching C structure representation, should use
22 a pointer to the struct instead of a generic MonoObject pointer.
24 Instance methods that are internal calls will receive as first argument
25 the instance object, so you must account for it in the C method signature:
27 [MethodImplAttribute(MethodImplOptions.InternalCall)]
28 public extern override int GetHashCode ();
32 gint32 ves_icall_System_String_GetHashCode (MonoString *this);
36 * How to hook internal calls with the runtime
38 Once you require an internal call in corlib, you need to create a C
39 implementation for it and register it in a static table in metadata/icall.c.
40 Add an entry in the table like:
42 "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
44 Note that you need to include the full namespace.name of the class.
45 If there are overloaded methods, you need also to specify the signature
48 [MethodImplAttribute(MethodImplOptions.InternalCall)]
49 public extern override void DoSomething ();
50 [MethodImplAttribute(MethodImplOptions.InternalCall)]
51 public extern override void DoSomething (bool useful);
53 should be mapped with:
55 "Namespace.ClassName::DoSomething()", ves_icall_Namespace_ClassName_DoSomething,
56 "Namespace.ClassName::DoSomething(bool)", ves_icall_Namespace_ClassName_DoSomething_bool,