5 The Common Language Infrastructure allows for methods to be
6 implemented in unmanaged code. Unlike the Platform Invocation
7 services which provide marshalling and unmarshalling of data
8 from managed to unmanaged and viceversa the Internal calls do
9 not perform any kind of marshalling.
13 The following lists how the C# types are exposed to the C API.
16 -----------------------------
27 IntPtr/UIntPtr gpointer
33 For ref and out paramaters you'll use the corresponding
36 So if you have a C# type listed as "ref int", you should use
37 "int *" in your implementation.
41 Arrays of any type must be described with a MonoArray* and the
42 elements must be accessed with the mono_array_* macros.
46 Any other type that has a matching C structure representation,
47 should use a pointer to the struct instead of a generic
52 Instance methods that are internal calls will receive as first argument
53 the instance object, so you must account for it in the C method signature:
55 [MethodImplAttribute(MethodImplOptions.InternalCall)]
56 public extern override int GetHashCode ();
60 gint32 ves_icall_System_String_GetHashCode (MonoString *this);
62 * How to hook internal calls with the runtime
64 Once you require an internal call in corlib, you need to
65 create a C implementation for it and register it in a
66 table in metadata/icall-def.h. See the top of that file
69 If there are overloaded methods, you need also to
70 specify the signature of _all_ of them:
72 [MethodImplAttribute(MethodImplOptions.InternalCall)]
73 public extern override void DoSomething ();
74 [MethodImplAttribute(MethodImplOptions.InternalCall)]
75 public extern override void DoSomething (bool useful);
77 should be mapped with the following method names:
79 "DoSomething()", ves_icall_Namespace_ClassName_DoSomething,
80 "DoSomething(bool)", ves_icall_Namespace_ClassName_DoSomething_bool,