Merge pull request #681 from tritao/dll-api
[mono.git] / mono / metadata / marshal.h
1
2 /*
3  * marshal.h: Routines for marshaling complex types in P/Invoke methods.
4  * 
5  * Author:
6  *   Paolo Molaro (lupus@ximian.com)
7  *
8  * (C) 2002 Ximian, Inc.  http://www.ximian.com
9  *
10  */
11
12 #ifndef __MONO_MARSHAL_H__
13 #define __MONO_MARSHAL_H__
14
15 #include <mono/metadata/class.h>
16 #include <mono/metadata/object-internals.h>
17 #include <mono/metadata/class-internals.h>
18 #include <mono/metadata/opcodes.h>
19 #include <mono/metadata/reflection.h>
20 #include <mono/metadata/method-builder.h>
21
22 #define mono_marshal_find_bitfield_offset(type, elem, byte_offset, bitmask) \
23         do { \
24                 type tmp; \
25                 memset (&tmp, 0, sizeof (tmp)); \
26                 tmp.elem = 1; \
27                 mono_marshal_find_nonzero_bit_offset ((guint8*)&tmp, sizeof (tmp), (byte_offset), (bitmask)); \
28         } while (0)
29
30 /*
31  * This structure holds the state kept by the emit_ marshalling functions.
32  * This is exported so it can be used by cominterop.c.
33  */
34 typedef struct {
35         MonoMethodBuilder *mb;
36         MonoMethodSignature *sig;
37         MonoMethodPInvoke *piinfo;
38         int *orig_conv_args; /* Locals containing the original values of byref args */
39         int retobj_var;
40         MonoClass *retobj_class;
41         MonoMethodSignature *csig; /* Might need to be changed due to MarshalAs directives */
42         MonoImage *image; /* The image to use for looking up custom marshallers */
43 } EmitMarshalContext;
44
45 typedef enum {
46         /*
47          * This is invoked to convert arguments from the current types to
48          * the underlying types expected by the platform routine.  If required,
49          * the methods create a temporary variable with the proper type, and return
50          * the location for it (either the passed argument, or the newly allocated
51          * local slot).
52          */
53         MARSHAL_ACTION_CONV_IN,
54
55         /*
56          * This operation is called to push the actual value that was optionally
57          * converted on the first stage
58          */
59         MARSHAL_ACTION_PUSH,
60
61         /*
62          * Convert byref arguments back or free resources allocated during the
63          * CONV_IN stage
64          */
65         MARSHAL_ACTION_CONV_OUT,
66
67         /*
68          * The result from the unmanaged call is at the top of the stack when
69          * this action is invoked.    The result should be stored in the
70          * third local variable slot. 
71          */
72         MARSHAL_ACTION_CONV_RESULT,
73
74         MARSHAL_ACTION_MANAGED_CONV_IN,
75         MARSHAL_ACTION_MANAGED_CONV_OUT,
76         MARSHAL_ACTION_MANAGED_CONV_RESULT
77 } MarshalAction;
78
79 /*
80  * This is an extension of the MONO_WRAPPER_ enum to avoid adding more elements to that
81  * enum.
82  */
83 typedef enum {
84         WRAPPER_SUBTYPE_NONE,
85         /* Subtypes of MONO_WRAPPER_MANAGED_TO_MANAGED */
86         WRAPPER_SUBTYPE_ELEMENT_ADDR,
87         WRAPPER_SUBTYPE_STRING_CTOR,
88         /* Subtypes of MONO_WRAPPER_STELEMREF */
89         WRAPPER_SUBTYPE_VIRTUAL_STELEMREF,
90         /* Subtypes of MONO_WRAPPER_UNKNOWN */
91         WRAPPER_SUBTYPE_FAST_MONITOR_ENTER,
92         WRAPPER_SUBTYPE_FAST_MONITOR_ENTER_V4,
93         WRAPPER_SUBTYPE_FAST_MONITOR_EXIT,
94         WRAPPER_SUBTYPE_PTR_TO_STRUCTURE,
95         WRAPPER_SUBTYPE_STRUCTURE_TO_PTR,
96         /* Subtypes of MONO_WRAPPER_CASTCLASS */
97         WRAPPER_SUBTYPE_CASTCLASS_WITH_CACHE,
98         WRAPPER_SUBTYPE_ISINST_WITH_CACHE,
99         /* Subtypes of MONO_WRAPPER_RUNTIME_INVOKE */
100         WRAPPER_SUBTYPE_RUNTIME_INVOKE_NORMAL,
101         WRAPPER_SUBTYPE_RUNTIME_INVOKE_DYNAMIC,
102         WRAPPER_SUBTYPE_RUNTIME_INVOKE_DIRECT,
103         WRAPPER_SUBTYPE_RUNTIME_INVOKE_VIRTUAL,
104         /* Subtypes of MONO_WRAPPER_MANAGED_TO_NATIVE */
105         WRAPPER_SUBTYPE_ICALL_WRAPPER,
106         WRAPPER_SUBTYPE_NATIVE_FUNC_AOT,
107         /* Subtypes of MONO_WRAPPER_UNKNOWN */
108         WRAPPER_SUBTYPE_SYNCHRONIZED_INNER,
109         WRAPPER_SUBTYPE_GSHAREDVT_IN,
110         WRAPPER_SUBTYPE_GSHAREDVT_OUT,
111         WRAPPER_SUBTYPE_ARRAY_ACCESSOR,
112         /* Subtypes of MONO_WRAPPER_MANAGED_TO_MANAGED */
113         WRAPPER_SUBTYPE_GENERIC_ARRAY_HELPER
114 } WrapperSubtype;
115
116 typedef struct {
117         MonoMethod *method;
118         MonoClass *klass;
119 } NativeToManagedWrapperInfo;
120
121 typedef struct {
122         MonoMethod *method;
123 } StringCtorWrapperInfo;
124
125 typedef struct {
126         int kind;
127 } VirtualStelemrefWrapperInfo;
128
129 typedef struct {
130         guint32 rank, elem_size;
131 } ElementAddrWrapperInfo;
132
133 typedef struct {
134         MonoMethod *method;
135         /* For WRAPPER_SUBTYPE_RUNTIME_INVOKE_NORMAL */
136         MonoMethodSignature *sig;
137 } RuntimeInvokeWrapperInfo;
138
139 typedef struct {
140         MonoMethod *method;
141 } ManagedToNativeWrapperInfo;
142
143 typedef struct {
144         MonoMethod *method;
145 } SynchronizedInnerWrapperInfo;
146
147 typedef struct {
148         MonoMethod *method;
149 } GenericArrayHelperWrapperInfo;
150
151 typedef struct {
152         gpointer func;
153 } ICallWrapperInfo;
154
155 typedef struct {
156         MonoMethod *method;
157 } ArrayAccessorWrapperInfo;
158
159 /*
160  * This structure contains additional information to uniquely identify a given wrapper
161  * method. It can be retrieved by mono_marshal_get_wrapper_info () for certain types
162  * of wrappers, i.e. ones which do not have a 1-1 association with a method/class.
163  */
164 typedef struct {
165         WrapperSubtype subtype;
166         union {
167                 /* RUNTIME_INVOKE_... */
168                 RuntimeInvokeWrapperInfo runtime_invoke;
169                 /* STRING_CTOR */
170                 StringCtorWrapperInfo string_ctor;
171                 /* ELEMENT_ADDR */
172                 ElementAddrWrapperInfo element_addr;
173                 /* VIRTUAL_STELEMREF */
174                 VirtualStelemrefWrapperInfo virtual_stelemref;
175                 /* MONO_WRAPPER_NATIVE_TO_MANAGED */
176                 NativeToManagedWrapperInfo native_to_managed;
177                 /* MONO_WRAPPER_MANAGED_TO_NATIVE */
178                 ManagedToNativeWrapperInfo managed_to_native;
179                 /* SYNCHRONIZED_INNER */
180                 SynchronizedInnerWrapperInfo synchronized_inner;
181                 /* GENERIC_ARRAY_HELPER */
182                 GenericArrayHelperWrapperInfo generic_array_helper;
183                 /* ICALL_WRAPPER */
184                 ICallWrapperInfo icall;
185                 /* ARRAY_ACCESSOR */
186                 ArrayAccessorWrapperInfo array_accessor;
187         } d;
188 } WrapperInfo;
189
190 G_BEGIN_DECLS
191
192 /*type of the function pointer of methods returned by mono_marshal_get_runtime_invoke*/
193 typedef MonoObject *(*RuntimeInvokeFunction) (MonoObject *this, void **params, MonoObject **exc, void* compiled_method);
194
195 typedef void (*RuntimeInvokeDynamicFunction) (void *args, MonoObject **exc, void* compiled_method);
196
197 /* marshaling helper functions */
198
199 void
200 mono_marshal_init (void) MONO_INTERNAL;
201
202 void
203 mono_marshal_init_tls (void) MONO_INTERNAL;
204
205 void
206 mono_marshal_cleanup (void) MONO_INTERNAL;
207
208 gint32
209 mono_class_native_size (MonoClass *klass, guint32 *align) MONO_INTERNAL;
210
211 MonoMarshalType *
212 mono_marshal_load_type_info (MonoClass* klass) MONO_INTERNAL;
213
214 gint32
215 mono_marshal_type_size (MonoType *type, MonoMarshalSpec *mspec, guint32 *align,
216                         gboolean as_field, gboolean unicode) MONO_INTERNAL;
217
218 int            
219 mono_type_native_stack_size (MonoType *type, guint32 *alignment) MONO_INTERNAL;
220
221 gpointer
222 mono_array_to_savearray (MonoArray *array) MONO_INTERNAL;
223
224 gpointer
225 mono_array_to_lparray (MonoArray *array) MONO_INTERNAL;
226
227 void
228 mono_free_lparray (MonoArray *array, gpointer* nativeArray) MONO_INTERNAL;
229
230 void
231 mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text) MONO_INTERNAL;
232
233 void
234 mono_string_utf16_to_builder (MonoStringBuilder *sb, gunichar2 *text) MONO_INTERNAL;
235
236 gpointer
237 mono_string_builder_to_utf8 (MonoStringBuilder *sb) MONO_INTERNAL;
238
239 gpointer
240 mono_string_builder_to_utf16 (MonoStringBuilder *sb) MONO_INTERNAL;
241
242 gpointer
243 mono_string_to_ansibstr (MonoString *string_obj) MONO_INTERNAL;
244
245 gpointer
246 mono_string_to_bstr (MonoString *string_obj) MONO_INTERNAL;
247
248 void
249 mono_string_to_byvalstr (gpointer dst, MonoString *src, int size) MONO_INTERNAL;
250
251 void
252 mono_string_to_byvalwstr (gpointer dst, MonoString *src, int size) MONO_INTERNAL;
253
254 gpointer
255 mono_delegate_to_ftnptr (MonoDelegate *delegate) MONO_INTERNAL;
256
257 MonoDelegate*
258 mono_ftnptr_to_delegate (MonoClass *klass, gpointer ftn) MONO_INTERNAL;
259
260 void mono_delegate_free_ftnptr (MonoDelegate *delegate) MONO_INTERNAL;
261
262 void
263 mono_marshal_set_last_error (void) MONO_INTERNAL;
264
265 gpointer
266 mono_marshal_asany (MonoObject *obj, MonoMarshalNative string_encoding, int param_attrs) MONO_INTERNAL;
267
268 void
269 mono_marshal_free_asany (MonoObject *o, gpointer ptr, MonoMarshalNative string_encoding, int param_attrs) MONO_INTERNAL;
270
271 guint
272 mono_type_to_ldind (MonoType *type) MONO_INTERNAL;
273
274 guint
275 mono_type_to_stind (MonoType *type) MONO_INTERNAL;
276
277 /* functions to create various architecture independent helper functions */
278
279 MonoMethod *
280 mono_marshal_method_from_wrapper (MonoMethod *wrapper) MONO_INTERNAL;
281
282 void
283 mono_marshal_set_wrapper_info (MonoMethod *method, gpointer data) MONO_INTERNAL;
284
285 gpointer
286 mono_marshal_get_wrapper_info (MonoMethod *wrapper) MONO_INTERNAL;
287
288 MonoMethod *
289 mono_marshal_get_delegate_begin_invoke (MonoMethod *method) MONO_INTERNAL;
290
291 MonoMethod *
292 mono_marshal_get_delegate_end_invoke (MonoMethod *method) MONO_INTERNAL;
293
294 MonoMethod *
295 mono_marshal_get_delegate_invoke (MonoMethod *method, MonoDelegate *del) MONO_INTERNAL;
296
297 MonoMethod *
298 mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean virtual) MONO_INTERNAL;
299
300 MonoMethod*
301 mono_marshal_get_runtime_invoke_dynamic (void) MONO_INTERNAL;
302
303 MonoMethodSignature*
304 mono_marshal_get_string_ctor_signature (MonoMethod *method) MONO_INTERNAL;
305
306 MonoMethod *
307 mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc) MONO_INTERNAL;
308
309 gpointer
310 mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type) MONO_INTERNAL;
311
312 MonoMethod *
313 mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gconstpointer func, gboolean check_exceptions) MONO_INTERNAL;
314
315 MonoMethod *
316 mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, gboolean aot) MONO_INTERNAL;
317
318 MonoMethod *
319 mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func) MONO_INTERNAL;
320
321 MonoMethod*
322 mono_marshal_get_native_func_wrapper_aot (MonoClass *klass) MONO_INTERNAL;
323
324 MonoMethod *
325 mono_marshal_get_struct_to_ptr (MonoClass *klass) MONO_INTERNAL;
326
327 MonoMethod *
328 mono_marshal_get_ptr_to_struct (MonoClass *klass) MONO_INTERNAL;
329
330 MonoMethod *
331 mono_marshal_get_synchronized_wrapper (MonoMethod *method) MONO_INTERNAL;
332
333 MonoMethod *
334 mono_marshal_get_synchronized_inner_wrapper (MonoMethod *method) MONO_INTERNAL;
335
336 MonoMethod *
337 mono_marshal_get_unbox_wrapper (MonoMethod *method) MONO_INTERNAL;
338
339 MonoMethod *
340 mono_marshal_get_castclass_with_cache (void) MONO_INTERNAL;
341
342 MonoMethod *
343 mono_marshal_get_isinst_with_cache (void) MONO_INTERNAL;
344
345 MonoMethod *
346 mono_marshal_get_isinst (MonoClass *klass) MONO_INTERNAL;
347
348 MonoMethod *
349 mono_marshal_get_castclass (MonoClass *klass) MONO_INTERNAL;
350
351 MonoMethod *
352 mono_marshal_get_stelemref (void) MONO_INTERNAL;
353
354 MonoMethod*
355 mono_marshal_get_virtual_stelemref (MonoClass *array_class) MONO_INTERNAL;
356
357 MonoMethod**
358 mono_marshal_get_virtual_stelemref_wrappers (int *nwrappers) MONO_INTERNAL;
359
360 MonoMethod*
361 mono_marshal_get_array_address (int rank, int elem_size) MONO_INTERNAL;
362
363 MonoMethod *
364 mono_marshal_get_array_accessor_wrapper (MonoMethod *method) MONO_INTERNAL;
365
366 MonoMethod *
367 mono_marshal_get_generic_array_helper (MonoClass *class, MonoClass *iface,
368                                        gchar *name, MonoMethod *method) MONO_INTERNAL;
369
370 MonoMethod *
371 mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method) MONO_INTERNAL;
372
373 MonoMethod*
374 mono_marshal_get_gsharedvt_in_wrapper (void) MONO_INTERNAL;
375
376 MonoMethod*
377 mono_marshal_get_gsharedvt_out_wrapper (void) MONO_INTERNAL;
378
379 void
380 mono_marshal_free_dynamic_wrappers (MonoMethod *method) MONO_INTERNAL;
381
382 void
383 mono_marshal_free_inflated_wrappers (MonoMethod *method) MONO_INTERNAL;
384
385 /* marshaling internal calls */
386
387 void * 
388 mono_marshal_alloc (gulong size) MONO_INTERNAL;
389
390 void 
391 mono_marshal_free (gpointer ptr) MONO_INTERNAL;
392
393 void
394 mono_marshal_free_array (gpointer *ptr, int size) MONO_INTERNAL;
395
396 gboolean 
397 mono_marshal_free_ccw (MonoObject* obj) MONO_INTERNAL;
398
399 void
400 cominterop_release_all_rcws (void) MONO_INTERNAL; 
401
402 void
403 ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged (MonoArray *src, gint32 start_index,
404                                                                     gpointer dest, gint32 length) MONO_INTERNAL;
405
406 void
407 ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer src, gint32 start_index,
408                                                                       MonoArray *dest, gint32 length) MONO_INTERNAL;
409
410 MonoString *
411 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr) MONO_INTERNAL;
412
413 MonoString *
414 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (char *ptr, gint32 len) MONO_INTERNAL;
415
416 MonoString *
417 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (guint16 *ptr) MONO_INTERNAL;
418
419 MonoString *
420 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (guint16 *ptr, gint32 len) MONO_INTERNAL;
421
422 MonoString *
423 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (gpointer ptr) MONO_INTERNAL;
424
425 guint32
426 ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal (MonoReflectionMethod *m) MONO_INTERNAL;
427
428 guint32 
429 ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error (void) MONO_INTERNAL;
430
431 guint32 
432 ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rtype) MONO_INTERNAL;
433
434 void
435 ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObject *obj, gpointer dst, MonoBoolean delete_old) MONO_INTERNAL;
436
437 void
438 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gpointer src, MonoObject *dst) MONO_INTERNAL;
439
440 MonoObject *
441 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gpointer src, MonoReflectionType *type) MONO_INTERNAL;
442
443 int
444 ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *type, MonoString *field_name) MONO_INTERNAL;
445
446 gpointer
447 ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR (MonoString *string) MONO_INTERNAL;
448
449 gpointer
450 ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string) MONO_INTERNAL;
451
452 gpointer
453 ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString *string) MONO_INTERNAL;
454
455 void
456 ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoReflectionType *type) MONO_INTERNAL;
457
458 void*
459 ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size) MONO_INTERNAL;
460
461 void
462 ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr) MONO_INTERNAL;
463
464 gpointer 
465 ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, int size) MONO_INTERNAL;
466
467 void*
468 ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (int size) MONO_INTERNAL;
469
470 gpointer 
471 ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, int size) MONO_INTERNAL;
472
473 void
474 ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal (void *ptr) MONO_INTERNAL;
475
476 void
477 ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR (void *ptr) MONO_INTERNAL;
478
479 void*
480 ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement (MonoArray *arrayobj, int index) MONO_INTERNAL;
481
482 MonoDelegate*
483 ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal (void *ftn, MonoReflectionType *type) MONO_INTERNAL;
484
485 int
486 ves_icall_System_Runtime_InteropServices_Marshal_AddRefInternal (gpointer pUnk) MONO_INTERNAL;
487
488 int
489 ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (gpointer pUnk, gpointer riid, gpointer* ppv) MONO_INTERNAL;
490
491 int
492 ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (gpointer pUnk) MONO_INTERNAL;
493
494 void*
495 ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal (MonoObject* object) MONO_INTERNAL;
496
497 MonoObject*
498 ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW (void* pUnk) MONO_INTERNAL;
499
500 void*
501 ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal (MonoObject* object) MONO_INTERNAL;
502
503 void*
504 ves_icall_System_Runtime_InteropServices_Marshal_GetCCW (MonoObject* object, MonoReflectionType* type) MONO_INTERNAL;
505
506 MonoBoolean
507 ves_icall_System_Runtime_InteropServices_Marshal_IsComObject (MonoObject* object) MONO_INTERNAL;
508
509 gint32
510 ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal (MonoObject* object) MONO_INTERNAL;
511
512 MonoObject *
513 ves_icall_System_ComObject_CreateRCW (MonoReflectionType *type) MONO_INTERNAL;
514
515 void
516 ves_icall_System_ComObject_ReleaseInterfaces(MonoComObject* obj) MONO_INTERNAL;
517
518 gpointer
519 ves_icall_System_ComObject_GetInterfaceInternal (MonoComObject* obj, MonoReflectionType* type, MonoBoolean throw_exception) MONO_INTERNAL;
520
521 void
522 ves_icall_Mono_Interop_ComInteropProxy_AddProxy (gpointer pUnk, MonoComInteropProxy* proxy) MONO_INTERNAL;
523
524 MonoComInteropProxy*
525 ves_icall_Mono_Interop_ComInteropProxy_FindProxy (gpointer pUnk) MONO_INTERNAL;
526
527 MONO_API void
528 mono_win32_compat_CopyMemory (gpointer dest, gconstpointer source, gsize length);
529
530 MONO_API void
531 mono_win32_compat_FillMemory (gpointer dest, gsize length, guchar fill);
532
533 MONO_API void
534 mono_win32_compat_MoveMemory (gpointer dest, gconstpointer source, gsize length);
535
536 MONO_API void
537 mono_win32_compat_ZeroMemory (gpointer dest, gsize length);
538
539 void
540 mono_marshal_find_nonzero_bit_offset (guint8 *buf, int len, int *byte_offset, guint8 *bitmask) MONO_INTERNAL;
541
542 MonoMethodSignature*
543 mono_signature_no_pinvoke (MonoMethod *method) MONO_INTERNAL;
544
545 /* Called from cominterop.c */
546
547 void
548 mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func, gboolean aot, gboolean check_exceptions, gboolean func_param) MONO_INTERNAL;
549
550 void
551 mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, uint32_t target_handle) MONO_INTERNAL;
552
553 GHashTable*
554 mono_marshal_get_cache (GHashTable **var, GHashFunc hash_func, GCompareFunc equal_func) MONO_INTERNAL;
555
556 MonoMethod*
557 mono_marshal_find_in_cache (GHashTable *cache, gpointer key) MONO_INTERNAL;
558
559 MonoMethod*
560 mono_mb_create_and_cache (GHashTable *cache, gpointer key,
561                                                   MonoMethodBuilder *mb, MonoMethodSignature *sig,
562                                                   int max_stack) MONO_INTERNAL;
563 void
564 mono_marshal_emit_thread_interrupt_checkpoint (MonoMethodBuilder *mb) MONO_INTERNAL;
565
566 void
567 mono_marshal_use_aot_wrappers (gboolean use) MONO_INTERNAL;
568
569 MonoObject *
570 mono_marshal_xdomain_copy_value (MonoObject *val) MONO_INTERNAL;
571
572
573 #ifndef DISABLE_REMOTING
574
575 MonoMethod *
576 mono_marshal_get_remoting_invoke (MonoMethod *method) MONO_INTERNAL;
577
578 MonoMethod *
579 mono_marshal_get_xappdomain_invoke (MonoMethod *method) MONO_INTERNAL;
580
581 MonoMethod *
582 mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type) MONO_INTERNAL;
583
584 MonoMethod *
585 mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) MONO_INTERNAL;
586
587 MonoMethod *
588 mono_marshal_get_stfld_wrapper (MonoType *type) MONO_INTERNAL;
589
590 MonoMethod *
591 mono_marshal_get_ldfld_wrapper (MonoType *type) MONO_INTERNAL;
592
593 MonoMethod *
594 mono_marshal_get_ldflda_wrapper (MonoType *type) MONO_INTERNAL;
595
596 MonoMethod *
597 mono_marshal_get_ldfld_remote_wrapper (MonoClass *klass) MONO_INTERNAL;
598
599 MonoMethod *
600 mono_marshal_get_stfld_remote_wrapper (MonoClass *klass) MONO_INTERNAL;
601
602 MonoMethod *
603 mono_marshal_get_proxy_cancast (MonoClass *klass) MONO_INTERNAL;
604
605 #endif
606
607 G_END_DECLS
608
609 #endif /* __MONO_MARSHAL_H__ */
610
611