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