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