Moving BSTR conv to native code in SecureStringToBSTR.
[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 #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 } WrapperSubtype;
125
126 typedef struct {
127         MonoMethod *method;
128         MonoClass *klass;
129 } NativeToManagedWrapperInfo;
130
131 typedef struct {
132         MonoMethod *method;
133 } StringCtorWrapperInfo;
134
135 typedef struct {
136         int kind;
137 } VirtualStelemrefWrapperInfo;
138
139 typedef struct {
140         guint32 rank, elem_size;
141 } ElementAddrWrapperInfo;
142
143 typedef struct {
144         MonoMethod *method;
145         /* For WRAPPER_SUBTYPE_RUNTIME_INVOKE_NORMAL */
146         MonoMethodSignature *sig;
147 } RuntimeInvokeWrapperInfo;
148
149 typedef struct {
150         MonoMethod *method;
151 } ManagedToNativeWrapperInfo;
152
153 typedef struct {
154         MonoMethod *method;
155 } SynchronizedWrapperInfo;
156
157 typedef struct {
158         MonoMethod *method;
159 } SynchronizedInnerWrapperInfo;
160
161 typedef struct {
162         MonoMethod *method;
163 } GenericArrayHelperWrapperInfo;
164
165 typedef struct {
166         gpointer func;
167 } ICallWrapperInfo;
168
169 typedef struct {
170         MonoMethod *method;
171 } ArrayAccessorWrapperInfo;
172
173 typedef struct {
174         MonoClass *klass;
175 } ProxyWrapperInfo;
176
177 typedef struct {
178         const char *gc_name;
179         int alloc_type;
180 } AllocatorWrapperInfo;
181
182 typedef struct {
183         MonoMethod *method;
184 } UnboxWrapperInfo;
185
186 typedef struct {
187         MonoMethod *method;
188 } RemotingWrapperInfo;
189
190 typedef struct {
191         MonoMethodSignature *sig;
192 } GsharedvtWrapperInfo;
193
194 /*
195  * This structure contains additional information to uniquely identify a given wrapper
196  * method. It can be retrieved by mono_marshal_get_wrapper_info () for certain types
197  * of wrappers, i.e. ones which do not have a 1-1 association with a method/class.
198  */
199 typedef struct {
200         WrapperSubtype subtype;
201         union {
202                 /* RUNTIME_INVOKE_... */
203                 RuntimeInvokeWrapperInfo runtime_invoke;
204                 /* STRING_CTOR */
205                 StringCtorWrapperInfo string_ctor;
206                 /* ELEMENT_ADDR */
207                 ElementAddrWrapperInfo element_addr;
208                 /* VIRTUAL_STELEMREF */
209                 VirtualStelemrefWrapperInfo virtual_stelemref;
210                 /* MONO_WRAPPER_NATIVE_TO_MANAGED */
211                 NativeToManagedWrapperInfo native_to_managed;
212                 /* MONO_WRAPPER_MANAGED_TO_NATIVE */
213                 ManagedToNativeWrapperInfo managed_to_native;
214                 /* SYNCHRONIZED */
215                 SynchronizedWrapperInfo synchronized;
216                 /* SYNCHRONIZED_INNER */
217                 SynchronizedInnerWrapperInfo synchronized_inner;
218                 /* GENERIC_ARRAY_HELPER */
219                 GenericArrayHelperWrapperInfo generic_array_helper;
220                 /* ICALL_WRAPPER */
221                 ICallWrapperInfo icall;
222                 /* ARRAY_ACCESSOR */
223                 ArrayAccessorWrapperInfo array_accessor;
224                 /* PROXY_ISINST etc. */
225                 ProxyWrapperInfo proxy;
226                 /* ALLOC */
227                 AllocatorWrapperInfo alloc;
228                 /* UNBOX */
229                 UnboxWrapperInfo unbox;
230                 /* MONO_WRAPPER_REMOTING_INVOKE/MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK/MONO_WRAPPER_XDOMAIN_INVOKE */
231                 RemotingWrapperInfo remoting;
232                 /* GSHAREDVT_IN_SIG/GSHAREDVT_OUT_SIG */
233                 GsharedvtWrapperInfo gsharedvt;
234         } d;
235 } WrapperInfo;
236
237 G_BEGIN_DECLS
238
239 /*type of the function pointer of methods returned by mono_marshal_get_runtime_invoke*/
240 typedef MonoObject *(*RuntimeInvokeFunction) (MonoObject *this_obj, void **params, MonoObject **exc, void* compiled_method);
241
242 typedef void (*RuntimeInvokeDynamicFunction) (void *args, MonoObject **exc, void* compiled_method);
243
244 /* marshaling helper functions */
245
246 void
247 mono_marshal_init (void);
248
249 void
250 mono_marshal_init_tls (void);
251
252 void
253 mono_marshal_cleanup (void);
254
255 gint32
256 mono_class_native_size (MonoClass *klass, guint32 *align);
257
258 MonoMarshalType *
259 mono_marshal_load_type_info (MonoClass* klass);
260
261 gint32
262 mono_marshal_type_size (MonoType *type, MonoMarshalSpec *mspec, guint32 *align,
263                         gboolean as_field, gboolean unicode);
264
265 int            
266 mono_type_native_stack_size (MonoType *type, guint32 *alignment);
267
268 gpointer
269 mono_string_to_ansibstr (MonoString *string_obj);
270
271 gpointer
272 mono_ptr_to_bstr (gpointer ptr, int slen);
273
274 gpointer
275 mono_string_to_bstr(MonoString* str);
276
277 void mono_delegate_free_ftnptr (MonoDelegate *delegate);
278
279 void
280 mono_marshal_set_last_error (void);
281
282 guint
283 mono_type_to_ldind (MonoType *type);
284
285 guint
286 mono_type_to_stind (MonoType *type);
287
288 /* functions to create various architecture independent helper functions */
289
290 MonoMethod *
291 mono_marshal_method_from_wrapper (MonoMethod *wrapper);
292
293 WrapperInfo*
294 mono_wrapper_info_create (MonoMethodBuilder *mb, WrapperSubtype subtype);
295
296 void
297 mono_marshal_set_wrapper_info (MonoMethod *method, WrapperInfo *info);
298
299 WrapperInfo*
300 mono_marshal_get_wrapper_info (MonoMethod *wrapper);
301
302 MonoMethod *
303 mono_marshal_get_delegate_begin_invoke (MonoMethod *method);
304
305 MonoMethod *
306 mono_marshal_get_delegate_end_invoke (MonoMethod *method);
307
308 MonoMethod *
309 mono_marshal_get_delegate_invoke (MonoMethod *method, MonoDelegate *del);
310
311 MonoMethod *
312 mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt, gboolean static_method_with_first_arg_bound, MonoMethod *target_method);
313
314 MonoMethod *
315 mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean is_virtual);
316
317 MonoMethod*
318 mono_marshal_get_runtime_invoke_dynamic (void);
319
320 MonoMethod *
321 mono_marshal_get_runtime_invoke_for_sig (MonoMethodSignature *sig);
322
323 MonoMethodSignature*
324 mono_marshal_get_string_ctor_signature (MonoMethod *method);
325
326 MonoMethod *
327 mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc);
328
329 gpointer
330 mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type);
331
332 MonoMethod *
333 mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gconstpointer func, gboolean check_exceptions);
334
335 MonoMethod *
336 mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, gboolean aot);
337
338 MonoMethod *
339 mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func);
340
341 MonoMethod*
342 mono_marshal_get_native_func_wrapper_aot (MonoClass *klass);
343
344 MonoMethod *
345 mono_marshal_get_struct_to_ptr (MonoClass *klass);
346
347 MonoMethod *
348 mono_marshal_get_ptr_to_struct (MonoClass *klass);
349
350 MonoMethod *
351 mono_marshal_get_synchronized_wrapper (MonoMethod *method);
352
353 MonoMethod *
354 mono_marshal_get_synchronized_inner_wrapper (MonoMethod *method);
355
356 MonoMethod *
357 mono_marshal_get_unbox_wrapper (MonoMethod *method);
358
359 MonoMethod *
360 mono_marshal_get_castclass_with_cache (void);
361
362 MonoMethod *
363 mono_marshal_get_isinst_with_cache (void);
364
365 MonoMethod *
366 mono_marshal_get_isinst (MonoClass *klass);
367
368 MonoMethod *
369 mono_marshal_get_castclass (MonoClass *klass);
370
371 MonoMethod *
372 mono_marshal_get_stelemref (void);
373
374 MonoMethod*
375 mono_marshal_get_virtual_stelemref (MonoClass *array_class);
376
377 MonoMethod**
378 mono_marshal_get_virtual_stelemref_wrappers (int *nwrappers);
379
380 MonoMethod*
381 mono_marshal_get_array_address (int rank, int elem_size);
382
383 MonoMethod *
384 mono_marshal_get_array_accessor_wrapper (MonoMethod *method);
385
386 MonoMethod *
387 mono_marshal_get_generic_array_helper (MonoClass *klass, MonoClass *iface,
388                                        gchar *name, MonoMethod *method);
389
390 MonoMethod *
391 mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method);
392
393 MonoMethod*
394 mono_marshal_get_gsharedvt_in_wrapper (void);
395
396 MonoMethod*
397 mono_marshal_get_gsharedvt_out_wrapper (void);
398
399 void
400 mono_marshal_free_dynamic_wrappers (MonoMethod *method);
401
402 void
403 mono_marshal_lock_internal (void);
404
405 void
406 mono_marshal_unlock_internal (void);
407
408 /* marshaling internal calls */
409
410 void * 
411 mono_marshal_alloc (gulong size, MonoError *error);
412
413 void 
414 mono_marshal_free (gpointer ptr);
415
416 void
417 mono_marshal_free_array (gpointer *ptr, int size);
418
419 gboolean 
420 mono_marshal_free_ccw (MonoObject* obj);
421
422 void
423 cominterop_release_all_rcws (void); 
424
425 void
426 ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged (MonoArray *src, gint32 start_index,
427                                                                     gpointer dest, gint32 length);
428
429 void
430 ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer src, gint32 start_index,
431                                                                       MonoArray *dest, gint32 length);
432
433 MonoString *
434 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr);
435
436 MonoString *
437 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (char *ptr, gint32 len);
438
439 MonoString *
440 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (guint16 *ptr);
441
442 MonoString *
443 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (guint16 *ptr, gint32 len);
444
445 MonoString *
446 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (gpointer ptr);
447
448 guint32
449 ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal (MonoReflectionMethod *m);
450
451 guint32 
452 ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error (void);
453
454 guint32 
455 ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rtype);
456
457 void
458 ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObject *obj, gpointer dst, MonoBoolean delete_old);
459
460 void
461 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gpointer src, MonoObject *dst);
462
463 MonoObject *
464 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gpointer src, MonoReflectionType *type);
465
466 int
467 ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *type, MonoString *field_name);
468
469 gpointer
470 ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR (MonoString *string);
471
472 gpointer
473 ves_icall_System_Runtime_InteropServices_Marshal_BufferToBSTR (MonoArray *ptr, int len);
474
475 gpointer
476 ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string);
477
478 gpointer
479 ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString *string);
480
481 void
482 ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoReflectionType *type);
483
484 void*
485 ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size);
486
487 void
488 ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr);
489
490 gpointer 
491 ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, int size);
492
493 void*
494 ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (gpointer size);
495
496 gpointer 
497 ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, gpointer size);
498
499 void
500 ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal (void *ptr);
501
502 void
503 ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR (void *ptr);
504
505 void*
506 ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement (MonoArray *arrayobj, int index);
507
508 MonoDelegate*
509 ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal (void *ftn, MonoReflectionType *type);
510
511 gpointer
512 ves_icall_System_Runtime_InteropServices_Marshal_GetFunctionPointerForDelegateInternal (MonoDelegate *delegate);
513
514 int
515 ves_icall_System_Runtime_InteropServices_Marshal_AddRefInternal (gpointer pUnk);
516
517 int
518 ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (gpointer pUnk, gpointer riid, gpointer* ppv);
519
520 int
521 ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (gpointer pUnk);
522
523 void*
524 ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal (MonoObject* object);
525
526 MonoObject*
527 ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW (void* pUnk);
528
529 void*
530 ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal (MonoObject* object);
531
532 void*
533 ves_icall_System_Runtime_InteropServices_Marshal_GetCCW (MonoObject* object, MonoReflectionType* type);
534
535 MonoBoolean
536 ves_icall_System_Runtime_InteropServices_Marshal_IsComObject (MonoObject* object);
537
538 gint32
539 ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal (MonoObject* object);
540
541 MonoObject *
542 ves_icall_System_ComObject_CreateRCW (MonoReflectionType *type);
543
544 void
545 ves_icall_System_ComObject_ReleaseInterfaces(MonoComObject* obj);
546
547 gpointer
548 ves_icall_System_ComObject_GetInterfaceInternal (MonoComObject* obj, MonoReflectionType* type, MonoBoolean throw_exception);
549
550 void
551 ves_icall_Mono_Interop_ComInteropProxy_AddProxy (gpointer pUnk, MonoComInteropProxy* proxy);
552
553 MonoComInteropProxy*
554 ves_icall_Mono_Interop_ComInteropProxy_FindProxy (gpointer pUnk);
555
556 MONO_API void
557 mono_win32_compat_CopyMemory (gpointer dest, gconstpointer source, gsize length);
558
559 MONO_API void
560 mono_win32_compat_FillMemory (gpointer dest, gsize length, guchar fill);
561
562 MONO_API void
563 mono_win32_compat_MoveMemory (gpointer dest, gconstpointer source, gsize length);
564
565 MONO_API void
566 mono_win32_compat_ZeroMemory (gpointer dest, gsize length);
567
568 void
569 mono_marshal_find_nonzero_bit_offset (guint8 *buf, int len, int *byte_offset, guint8 *bitmask) MONO_LLVM_INTERNAL;
570
571 MonoMethodSignature*
572 mono_signature_no_pinvoke (MonoMethod *method);
573
574 /* Called from cominterop.c/remoting.c */
575
576 void
577 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);
578
579 void
580 mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, uint32_t target_handle);
581
582 GHashTable*
583 mono_marshal_get_cache (GHashTable **var, GHashFunc hash_func, GCompareFunc equal_func);
584
585 MonoMethod*
586 mono_marshal_find_in_cache (GHashTable *cache, gpointer key);
587
588 MonoMethod*
589 mono_mb_create_and_cache (GHashTable *cache, gpointer key,
590                                                   MonoMethodBuilder *mb, MonoMethodSignature *sig,
591                                                   int max_stack);
592 void
593 mono_marshal_emit_thread_interrupt_checkpoint (MonoMethodBuilder *mb);
594
595 void
596 mono_marshal_emit_thread_force_interrupt_checkpoint (MonoMethodBuilder *mb);
597
598 void
599 mono_marshal_use_aot_wrappers (gboolean use);
600
601 MonoObject *
602 mono_marshal_xdomain_copy_value (MonoObject *val, MonoError *error);
603
604 MonoObject *
605 ves_icall_mono_marshal_xdomain_copy_value (MonoObject *val);
606
607 int
608 mono_mb_emit_save_args (MonoMethodBuilder *mb, MonoMethodSignature *sig, gboolean save_this);
609
610 void
611 mono_mb_emit_restore_result (MonoMethodBuilder *mb, MonoType *return_type);
612
613 MonoMethod*
614 mono_mb_create (MonoMethodBuilder *mb, MonoMethodSignature *sig,
615                                 int max_stack, WrapperInfo *info);
616
617 MonoMethod*
618 mono_mb_create_and_cache_full (GHashTable *cache, gpointer key,
619                                                            MonoMethodBuilder *mb, MonoMethodSignature *sig,
620                                                            int max_stack, WrapperInfo *info, gboolean *out_found);
621
622 typedef void (*MonoFtnPtrEHCallback) (guint32 gchandle);
623
624 MONO_API void
625 mono_install_ftnptr_eh_callback (MonoFtnPtrEHCallback callback);
626
627 G_END_DECLS
628
629 #endif /* __MONO_MARSHAL_H__ */
630
631