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