3 * marshal.h: Routines for marshaling complex types in P/Invoke methods.
6 * Paolo Molaro (lupus@ximian.com)
8 * (C) 2002 Ximian, Inc. http://www.ximian.com
12 #ifndef __MONO_MARSHAL_H__
13 #define __MONO_MARSHAL_H__
15 #include <mono/metadata/class.h>
16 #include <mono/metadata/object.h>
18 /* ECMA lamespec: the old spec had more info... */
20 MONO_NATIVE_BOOLEAN = 0x02, /* 4 bytes, 0 is false, != 0 is true */
21 MONO_NATIVE_I1 = 0x03,
22 MONO_NATIVE_U1 = 0x04,
23 MONO_NATIVE_I2 = 0x05,
24 MONO_NATIVE_U2 = 0x06,
25 MONO_NATIVE_I4 = 0x07,
26 MONO_NATIVE_U4 = 0x08,
27 MONO_NATIVE_I8 = 0x09,
28 MONO_NATIVE_U8 = 0x0a,
29 MONO_NATIVE_R4 = 0x0b,
30 MONO_NATIVE_R8 = 0x0c,
31 MONO_NATIVE_CURRENCY = 0x0f,
32 MONO_NATIVE_BSTR = 0x13,
33 MONO_NATIVE_LPSTR = 0x14, /* char* */
34 MONO_NATIVE_LPWSTR = 0x15, /* gunichar2* */
35 MONO_NATIVE_LPTSTR = 0x16,
36 MONO_NATIVE_BYVALTSTR = 0x17,
37 MONO_NATIVE_IUNKNOWN = 0x19,
38 MONO_NATIVE_IDISPATCH = 0x1a,
39 MONO_NATIVE_STRUCT = 0x1b,
40 MONO_NATIVE_INTERFACE = 0x1c,
41 MONO_NATIVE_SAFEARRAY = 0x1d,
42 MONO_NATIVE_BYVALARRAY = 0x1e,
43 MONO_NATIVE_INT = 0x1f,
44 MONO_NATIVE_UINT = 0x20,
45 MONO_NATIVE_VBBYREFSTR = 0x22,
46 MONO_NATIVE_ANSIBSTR = 0x23,
47 MONO_NATIVE_TBSTR = 0x24,
48 MONO_NATIVE_VARIANTBOOL = 0x25,
49 MONO_NATIVE_FUNC = 0x26,
50 MONO_NATIVE_ASANY = 0x28,
51 MONO_NATIVE_ARRAY = 0x2a,
52 MONO_NATIVE_LPSTRUCT = 0x2b,
53 MONO_NATIVE_CUSTOM = 0x2c,
54 MONO_NATIVE_ERROR = 0x2d,
55 MONO_NATIVE_MAX = 0x50 /* no info */
59 MonoClassField *field;
66 struct MonoMarshalType {
67 guint32 unmanaged_size;
69 MonoMarshalField fields [MONO_ZERO_LEN_ARRAY];
72 void* mono_marshal_string_array (MonoArray *array);
74 guint32 mono_type_to_unmanaged (MonoType *type);
75 void mono_marshal_load_type_info (MonoClass* klass);
77 void* mono_marshal_alloc (gpointer size);
78 void mono_marshal_free (gpointer ptr);
79 void* mono_marshal_realloc (gpointer ptr, gpointer size);
81 #endif /* __MONO_MARSHAL_H__ */