Added MonoString<->UTF-32 conversion helper functions.
[mono.git] / mono / metadata / marshal.h
index 60cdf599184474959582910a161751fa5f1c3b1e..0c311c889336b0c290425de7a342617e9d57ab31 100644 (file)
@@ -97,18 +97,24 @@ typedef enum {
        WRAPPER_SUBTYPE_CASTCLASS_WITH_CACHE,
        WRAPPER_SUBTYPE_ISINST_WITH_CACHE,
        /* Subtypes of MONO_WRAPPER_RUNTIME_INVOKE */
+       WRAPPER_SUBTYPE_RUNTIME_INVOKE_NORMAL,
        WRAPPER_SUBTYPE_RUNTIME_INVOKE_DYNAMIC,
        WRAPPER_SUBTYPE_RUNTIME_INVOKE_DIRECT,
        WRAPPER_SUBTYPE_RUNTIME_INVOKE_VIRTUAL,
        /* Subtypes of MONO_WRAPPER_MANAGED_TO_NATIVE */
        WRAPPER_SUBTYPE_ICALL_WRAPPER,
        WRAPPER_SUBTYPE_NATIVE_FUNC_AOT,
+       WRAPPER_SUBTYPE_PINVOKE,
        /* Subtypes of MONO_WRAPPER_UNKNOWN */
        WRAPPER_SUBTYPE_SYNCHRONIZED_INNER,
        WRAPPER_SUBTYPE_GSHAREDVT_IN,
        WRAPPER_SUBTYPE_GSHAREDVT_OUT,
+       WRAPPER_SUBTYPE_ARRAY_ACCESSOR,
        /* Subtypes of MONO_WRAPPER_MANAGED_TO_MANAGED */
-       WRAPPER_SUBTYPE_GENERIC_ARRAY_HELPER
+       WRAPPER_SUBTYPE_GENERIC_ARRAY_HELPER,
+       /* Subtypes of MONO_WRAPPER_DELEGATE_INVOKE */
+       WRAPPER_SUBTYPE_DELEGATE_INVOKE_VIRTUAL,
+       WRAPPER_SUBTYPE_DELEGATE_INVOKE_BOUND
 } WrapperSubtype;
 
 typedef struct {
@@ -130,6 +136,8 @@ typedef struct {
 
 typedef struct {
        MonoMethod *method;
+       /* For WRAPPER_SUBTYPE_RUNTIME_INVOKE_NORMAL */
+       MonoMethodSignature *sig;
 } RuntimeInvokeWrapperInfo;
 
 typedef struct {
@@ -144,6 +152,14 @@ typedef struct {
        MonoMethod *method;
 } GenericArrayHelperWrapperInfo;
 
+typedef struct {
+       gpointer func;
+} ICallWrapperInfo;
+
+typedef struct {
+       MonoMethod *method;
+} ArrayAccessorWrapperInfo;
+
 /*
  * This structure contains additional information to uniquely identify a given wrapper
  * method. It can be retrieved by mono_marshal_get_wrapper_info () for certain types
@@ -168,13 +184,17 @@ typedef struct {
                SynchronizedInnerWrapperInfo synchronized_inner;
                /* GENERIC_ARRAY_HELPER */
                GenericArrayHelperWrapperInfo generic_array_helper;
+               /* ICALL_WRAPPER */
+               ICallWrapperInfo icall;
+               /* ARRAY_ACCESSOR */
+               ArrayAccessorWrapperInfo array_accessor;
        } d;
 } WrapperInfo;
 
 G_BEGIN_DECLS
 
 /*type of the function pointer of methods returned by mono_marshal_get_runtime_invoke*/
-typedef MonoObject *(*RuntimeInvokeFunction) (MonoObject *this, void **params, MonoObject **exc, void* compiled_method);
+typedef MonoObject *(*RuntimeInvokeFunction) (MonoObject *this_obj, void **params, MonoObject **exc, void* compiled_method);
 
 typedef void (*RuntimeInvokeDynamicFunction) (void *args, MonoObject **exc, void* compiled_method);
 
@@ -183,6 +203,9 @@ typedef void (*RuntimeInvokeDynamicFunction) (void *args, MonoObject **exc, void
 void
 mono_marshal_init (void) MONO_INTERNAL;
 
+void
+mono_marshal_init_tls (void) MONO_INTERNAL;
+
 void
 mono_marshal_cleanup (void) MONO_INTERNAL;
 
@@ -276,7 +299,7 @@ MonoMethod *
 mono_marshal_get_delegate_invoke (MonoMethod *method, MonoDelegate *del) MONO_INTERNAL;
 
 MonoMethod *
-mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean virtual) MONO_INTERNAL;
+mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean is_virtual) MONO_INTERNAL;
 
 MonoMethod*
 mono_marshal_get_runtime_invoke_dynamic (void) MONO_INTERNAL;
@@ -335,11 +358,17 @@ mono_marshal_get_stelemref (void) MONO_INTERNAL;
 MonoMethod*
 mono_marshal_get_virtual_stelemref (MonoClass *array_class) MONO_INTERNAL;
 
+MonoMethod**
+mono_marshal_get_virtual_stelemref_wrappers (int *nwrappers) MONO_INTERNAL;
+
 MonoMethod*
 mono_marshal_get_array_address (int rank, int elem_size) MONO_INTERNAL;
 
 MonoMethod *
-mono_marshal_get_generic_array_helper (MonoClass *class, MonoClass *iface,
+mono_marshal_get_array_accessor_wrapper (MonoMethod *method) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_generic_array_helper (MonoClass *klass, MonoClass *iface,
                                       gchar *name, MonoMethod *method) MONO_INTERNAL;
 
 MonoMethod *
@@ -382,36 +411,6 @@ void
 ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer src, gint32 start_index,
                                                                      MonoArray *dest, gint32 length) MONO_INTERNAL;
 
-gpointer
-ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-unsigned char
-ves_icall_System_Runtime_InteropServices_Marshal_ReadByte (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-gint16
-ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16 (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-gint32
-ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32 (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-gint64
-ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64 (gpointer ptr, gint32 offset) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteByte (gpointer ptr, gint32 offset, unsigned char val) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr (gpointer ptr, gint32 offset, gpointer val) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16 (gpointer ptr, gint32 offset, gint16 val) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32 (gpointer ptr, gint32 offset, gint32 val) MONO_INTERNAL;
-
-void
-ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64 (gpointer ptr, gint32 offset, gint64 val) MONO_INTERNAL;
-
 MonoString *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr) MONO_INTERNAL;
 
@@ -529,16 +528,16 @@ ves_icall_Mono_Interop_ComInteropProxy_AddProxy (gpointer pUnk, MonoComInteropPr
 MonoComInteropProxy*
 ves_icall_Mono_Interop_ComInteropProxy_FindProxy (gpointer pUnk) MONO_INTERNAL;
 
-void
+MONO_API void
 mono_win32_compat_CopyMemory (gpointer dest, gconstpointer source, gsize length);
 
-void
+MONO_API void
 mono_win32_compat_FillMemory (gpointer dest, gsize length, guchar fill);
 
-void
+MONO_API void
 mono_win32_compat_MoveMemory (gpointer dest, gconstpointer source, gsize length);
 
-void
+MONO_API void
 mono_win32_compat_ZeroMemory (gpointer dest, gsize length);
 
 void