xbuild: use the AdditionalReferencePath items to locate assemblies
[mono.git] / mono / metadata / metadata-internals.h
1
2 #ifndef __MONO_METADATA_INTERNALS_H__
3 #define __MONO_METADATA_INTERNALS_H__
4
5 #include "mono/metadata/image.h"
6 #include "mono/metadata/blob.h"
7 #include "mono/metadata/mempool.h"
8 #include "mono/metadata/domain-internals.h"
9 #include "mono/metadata/mono-hash.h"
10 #include "mono/utils/mono-compiler.h"
11 #include "mono/utils/mono-dl.h"
12 #include "mono/utils/monobitset.h"
13 #include "mono/utils/mono-property-hash.h"
14 #include "mono/utils/mono-value-hash.h"
15 #include <mono/utils/mono-error.h>
16
17 struct _MonoType {
18         union {
19                 MonoClass *klass; /* for VALUETYPE and CLASS */
20                 MonoType *type;   /* for PTR */
21                 MonoArrayType *array; /* for ARRAY */
22                 MonoMethodSignature *method;
23                 MonoGenericParam *generic_param; /* for VAR and MVAR */
24                 MonoGenericClass *generic_class; /* for GENERICINST */
25         } data;
26         unsigned int attrs    : 16; /* param attributes or field flags */
27         MonoTypeEnum type     : 8;
28         unsigned int num_mods : 6;  /* max 64 modifiers follow at the end */
29         unsigned int byref    : 1;
30         unsigned int pinned   : 1;  /* valid when included in a local var signature */
31         MonoCustomMod modifiers [MONO_ZERO_LEN_ARRAY]; /* this may grow */
32 };
33
34 #define MONO_SIZEOF_TYPE (offsetof (struct _MonoType, modifiers))
35
36 #define MONO_SECMAN_FLAG_INIT(x)                (x & 0x2)
37 #define MONO_SECMAN_FLAG_GET_VALUE(x)           (x & 0x1)
38 #define MONO_SECMAN_FLAG_SET_VALUE(x,y)         do { x = ((y) ? 0x3 : 0x2); } while (0)
39
40 #define MONO_PUBLIC_KEY_TOKEN_LENGTH    17
41
42 #define MONO_PROCESSOR_ARCHITECTURE_NONE 0
43 #define MONO_PROCESSOR_ARCHITECTURE_MSIL 1
44 #define MONO_PROCESSOR_ARCHITECTURE_X86 2
45 #define MONO_PROCESSOR_ARCHITECTURE_IA64 3
46 #define MONO_PROCESSOR_ARCHITECTURE_AMD64 4
47
48 struct _MonoAssemblyName {
49         const char *name;
50         const char *culture;
51         const char *hash_value;
52         const mono_byte* public_key;
53         // string of 16 hex chars + 1 NULL
54         mono_byte public_key_token [MONO_PUBLIC_KEY_TOKEN_LENGTH];
55         uint32_t hash_alg;
56         uint32_t hash_len;
57         uint32_t flags;
58         uint16_t major, minor, build, revision, arch;
59 };
60
61 struct MonoTypeNameParse {
62         char *name_space;
63         char *name;
64         MonoAssemblyName assembly;
65         GList *modifiers; /* 0 -> byref, -1 -> pointer, > 0 -> array rank */
66         GPtrArray *type_arguments;
67         GList *nested;
68 };
69
70 struct _MonoAssembly {
71         /* 
72          * The number of appdomains which have this assembly loaded plus the number of 
73          * assemblies referencing this assembly through an entry in their image->references
74          * arrays. The later is needed because entries in the image->references array
75          * might point to assemblies which are only loaded in some appdomains, and without
76          * the additional reference, they can be freed at any time.
77          * The ref_count is initially 0.
78          */
79         int ref_count; /* use atomic operations only */
80         char *basedir;
81         MonoAssemblyName aname;
82         MonoImage *image;
83         GSList *friend_assembly_names; /* Computed by mono_assembly_load_friends () */
84         guint8 friend_assembly_names_inited;
85         guint8 in_gac;
86         guint8 dynamic;
87         guint8 corlib_internal;
88         gboolean ref_only;
89         guint8 wrap_non_exception_throws;
90         guint8 wrap_non_exception_throws_inited;
91         guint8 jit_optimizer_disabled;
92         guint8 jit_optimizer_disabled_inited;
93         /* security manager flags (one bit is for lazy initialization) */
94         guint32 ecma:2;         /* Has the ECMA key */
95         guint32 aptc:2;         /* Has the [AllowPartiallyTrustedCallers] attributes */
96         guint32 fulltrust:2;    /* Has FullTrust permission */
97         guint32 unmanaged:2;    /* Has SecurityPermissionFlag.UnmanagedCode permission */
98         guint32 skipverification:2;     /* Has SecurityPermissionFlag.SkipVerification permission */
99 };
100
101 typedef struct {
102         const char* data;
103         guint32  size;
104 } MonoStreamHeader;
105
106 struct _MonoTableInfo {
107         const char *base;
108         guint       rows     : 24;
109         guint       row_size : 8;
110
111         /*
112          * Tables contain up to 9 columns and the possible sizes of the
113          * fields in the documentation are 1, 2 and 4 bytes.  So we
114          * can encode in 2 bits the size.
115          *
116          * A 32 bit value can encode the resulting size
117          *
118          * The top eight bits encode the number of columns in the table.
119          * we only need 4, but 8 is aligned no shift required. 
120          */
121         guint32   size_bitfield;
122 };
123
124 #define REFERENCE_MISSING ((gpointer) -1)
125
126 typedef struct _MonoDllMap MonoDllMap;
127
128 struct _MonoImage {
129         /*
130          * The number of assemblies which reference this MonoImage though their 'image'
131          * field plus the number of images which reference this MonoImage through their 
132          * 'modules' field, plus the number of threads holding temporary references to
133          * this image between calls of mono_image_open () and mono_image_close ().
134          */
135         int   ref_count;
136         void *raw_data_handle;
137         char *raw_data;
138         guint32 raw_data_len;
139         guint8 raw_buffer_used    : 1;
140         guint8 raw_data_allocated : 1;
141         guint8 fileio_used : 1;
142
143 #ifdef HOST_WIN32
144         /* Module was loaded using LoadLibrary. */
145         guint8 is_module_handle : 1;
146
147         /* Module entry point is _CorDllMain. */
148         guint8 has_entry_point : 1;
149 #endif
150
151         /* Whenever this is a dynamically emitted module */
152         guint8 dynamic : 1;
153
154         /* Whenever this is a reflection only image */
155         guint8 ref_only : 1;
156
157         /* Whenever this image contains uncompressed metadata */
158         guint8 uncompressed_metadata : 1;
159
160         guint8 checked_module_cctor : 1;
161         guint8 has_module_cctor : 1;
162
163         guint8 idx_string_wide : 1;
164         guint8 idx_guid_wide : 1;
165         guint8 idx_blob_wide : 1;
166
167         /* Whenever this image is considered as platform code for the CoreCLR security model */
168         guint8 core_clr_platform_code : 1;
169                             
170         char *name;
171         const char *assembly_name;
172         const char *module_name;
173         char *version;
174         gint16 md_version_major, md_version_minor;
175         char *guid;
176         void *image_info;
177         MonoMemPool         *mempool; /*protected by the image lock*/
178
179         char                *raw_metadata;
180                             
181         MonoStreamHeader     heap_strings;
182         MonoStreamHeader     heap_us;
183         MonoStreamHeader     heap_blob;
184         MonoStreamHeader     heap_guid;
185         MonoStreamHeader     heap_tables;
186                             
187         const char          *tables_base;
188
189         /**/
190         MonoTableInfo        tables [MONO_TABLE_NUM];
191
192         /*
193          * references is initialized only by using the mono_assembly_open
194          * function, and not by using the lowlevel mono_image_open.
195          *
196          * It is NULL terminated.
197          */
198         MonoAssembly **references;
199
200         MonoImage **modules;
201         guint32 module_count;
202         gboolean *modules_loaded;
203
204         MonoImage **files;
205
206         gpointer aot_module;
207
208         /*
209          * The Assembly this image was loaded from.
210          */
211         MonoAssembly *assembly;
212
213         /*
214          * Indexed by method tokens and typedef tokens.
215          */
216         GHashTable *method_cache; /*protected by the image lock*/
217         MonoInternalHashTable class_cache;
218
219         /* Indexed by memberref + methodspec tokens */
220         GHashTable *methodref_cache; /*protected by the image lock*/
221
222         /*
223          * Indexed by fielddef and memberref tokens
224          */
225         GHashTable *field_cache;
226
227         /* indexed by typespec tokens. */
228         GHashTable *typespec_cache;
229         /* indexed by token */
230         GHashTable *memberref_signatures;
231         GHashTable *helper_signatures;
232
233         /* Indexed by blob heap indexes */
234         GHashTable *method_signatures;
235
236         /*
237          * Indexes namespaces to hash tables that map class name to typedef token.
238          */
239         GHashTable *name_cache;  /*protected by the image lock*/
240
241         /*
242          * Indexed by MonoClass
243          */
244         GHashTable *array_cache;
245         GHashTable *ptr_cache;
246
247         GHashTable *szarray_cache;
248         /* This has a separate lock to improve scalability */
249         CRITICAL_SECTION szarray_cache_lock;
250
251         /*
252          * indexed by MonoMethodSignature 
253          */
254         GHashTable *delegate_begin_invoke_cache;
255         GHashTable *delegate_end_invoke_cache;
256         GHashTable *delegate_invoke_cache;
257         GHashTable *runtime_invoke_cache;
258
259         /*
260          * indexed by SignatureMethodPair
261          */
262         GHashTable *delegate_abstract_invoke_cache;
263
264         /*
265          * indexed by SignatureMethodPair
266          */
267         GHashTable *delegate_bound_static_invoke_cache;
268         /*
269          * indexed by MonoMethod pointers 
270          */
271         GHashTable *runtime_invoke_direct_cache;
272         GHashTable *runtime_invoke_vcall_cache;
273         GHashTable *managed_wrapper_cache;
274         GHashTable *native_wrapper_cache;
275         GHashTable *native_wrapper_aot_cache;
276         GHashTable *native_func_wrapper_aot_cache;
277         GHashTable *remoting_invoke_cache;
278         GHashTable *synchronized_cache;
279         GHashTable *unbox_wrapper_cache;
280         GHashTable *cominterop_invoke_cache;
281         GHashTable *cominterop_wrapper_cache; /* LOCKING: marshal lock */
282         GHashTable *thunk_invoke_cache;
283         GHashTable *wrapper_param_names;
284
285         /*
286          * indexed by MonoClass pointers
287          */
288         GHashTable *ldfld_wrapper_cache;
289         GHashTable *ldflda_wrapper_cache;
290         GHashTable *stfld_wrapper_cache;
291         GHashTable *isinst_cache;
292         GHashTable *castclass_cache;
293         GHashTable *proxy_isinst_cache;
294         GHashTable *rgctx_template_hash; /* LOCKING: templates lock */
295         GHashTable *delegate_invoke_generic_cache;
296         GHashTable *delegate_begin_invoke_generic_cache;
297         GHashTable *delegate_end_invoke_generic_cache;
298
299         /* Contains rarely used fields of runtime structures belonging to this image */
300         MonoPropertyHash *property_hash;
301
302         void *reflection_info;
303
304         /*
305          * user_info is a public field and is not touched by the
306          * metadata engine
307          */
308         void *user_info;
309
310         /* dll map entries */
311         MonoDllMap *dll_map;
312
313         /* interfaces IDs from this image */
314         MonoBitSet *interface_bitset;
315
316         /* when the image is being closed, this is abused as a list of
317            malloc'ed regions to be freed. */
318         GSList *reflection_info_unregister_classes;
319
320         /* List of image sets containing this image */
321         GSList *image_sets;
322
323         /* Caches for MonoClass-es representing anon generic params */
324         MonoClass **var_cache_fast;
325         MonoClass **mvar_cache_fast;
326         GHashTable *var_cache_slow;
327         GHashTable *mvar_cache_slow;
328
329         /* Maps malloc-ed char* pinvoke scope -> MonoDl* */
330         GHashTable *pinvoke_scopes;
331
332         /* Maps malloc-ed char* pinvoke scope -> malloced-ed char* filename */
333         GHashTable *pinvoke_scope_filenames;
334
335         /*
336          * No other runtime locks must be taken while holding this lock.
337          * It's meant to be used only to mutate and query structures part of this image.
338          */
339         CRITICAL_SECTION    lock;
340 };
341
342 /*
343  * Generic instances depend on many images, and they need to be deleted if one
344  * of the images they depend on is unloaded. For example,
345  * List<Foo> depends on both List's image and Foo's image.
346  * A MonoImageSet is the owner of all generic instances depending on the same set of
347  * images.
348  */
349 typedef struct {
350         int nimages;
351         MonoImage **images;
352
353         GHashTable *gclass_cache, *ginst_cache, *gmethod_cache, *gsignature_cache;
354
355         CRITICAL_SECTION    lock;
356
357         /*
358          * Memory for generic instances owned by this image set should be allocated from
359          * this mempool, using the mono_image_set_alloc family of functions.
360          */
361         MonoMemPool         *mempool;
362 } MonoImageSet;
363
364 enum {
365         MONO_SECTION_TEXT,
366         MONO_SECTION_RSRC,
367         MONO_SECTION_RELOC,
368         MONO_SECTION_MAX
369 };
370
371 typedef struct {
372         GHashTable *hash;
373         char *data;
374         guint32 alloc_size; /* malloced bytes */
375         guint32 index;
376         guint32 offset; /* from start of metadata */
377 } MonoDynamicStream;
378
379 typedef struct {
380         guint32 alloc_rows;
381         guint32 rows;
382         guint8  row_size; /*  calculated later with column_sizes */
383         guint8  columns;
384         guint32 next_idx;
385         guint32 *values; /* rows * columns */
386 } MonoDynamicTable;
387
388 struct _MonoDynamicAssembly {
389         MonoAssembly assembly;
390         char *strong_name;
391         guint32 strong_name_size;
392         guint8 run;
393         guint8 save;
394         MonoDomain *domain;
395 };
396
397 struct _MonoDynamicImage {
398         MonoImage image;
399         guint32 meta_size;
400         guint32 text_rva;
401         guint32 metadata_rva;
402         guint32 image_base;
403         guint32 cli_header_offset;
404         guint32 iat_offset;
405         guint32 idt_offset;
406         guint32 ilt_offset;
407         guint32 imp_names_offset;
408         struct {
409                 guint32 rva;
410                 guint32 size;
411                 guint32 offset;
412                 guint32 attrs;
413         } sections [MONO_SECTION_MAX];
414         GHashTable *typespec;
415         GHashTable *typeref;
416         GHashTable *handleref;
417         MonoGHashTable *handleref_managed;
418         MonoGHashTable *tokens;
419         GHashTable *blob_cache;
420         GHashTable *standalonesig_cache;
421         GList *array_methods;
422         GPtrArray *gen_params;
423         MonoGHashTable *token_fixups;
424         GHashTable *method_to_table_idx;
425         GHashTable *field_to_table_idx;
426         GHashTable *method_aux_hash;
427         GHashTable *vararg_aux_hash;
428         MonoGHashTable *generic_def_objects;
429         MonoGHashTable *methodspec;
430         /*
431          * Maps final token values to the object they describe.
432          */
433         MonoGHashTable *remapped_tokens;
434         gboolean run;
435         gboolean save;
436         gboolean initial_image;
437         guint32 pe_kind, machine;
438         char *strong_name;
439         guint32 strong_name_size;
440         char *win32_res;
441         guint32 win32_res_size;
442         guint8 *public_key;
443         int public_key_len;
444         MonoDynamicStream sheap;
445         MonoDynamicStream code; /* used to store method headers and bytecode */
446         MonoDynamicStream resources; /* managed embedded resources */
447         MonoDynamicStream us;
448         MonoDynamicStream blob;
449         MonoDynamicStream tstream;
450         MonoDynamicStream guid;
451         MonoDynamicTable tables [MONO_TABLE_NUM];
452         MonoClass *wrappers_type; /*wrappers are bound to this type instead of <Module>*/
453 };
454
455 /* Contains information about assembly binding */
456 typedef struct _MonoAssemblyBindingInfo {
457         char *name;
458         char *culture;
459         guchar public_key_token [MONO_PUBLIC_KEY_TOKEN_LENGTH];
460         int major;
461         int minor;
462         AssemblyVersionSet old_version_bottom;
463         AssemblyVersionSet old_version_top;
464         AssemblyVersionSet new_version;
465         guint has_old_version_bottom : 1;
466         guint has_old_version_top : 1;
467         guint has_new_version : 1;
468         guint is_valid : 1;
469         gint32 domain_id; /*Needed to unload per-domain binding*/
470 } MonoAssemblyBindingInfo;
471
472 struct _MonoMethodHeader {
473         const unsigned char  *code;
474 #ifdef MONO_SMALL_CONFIG
475         guint16      code_size;
476 #else
477         guint32      code_size;
478 #endif
479         guint16      max_stack   : 15;
480         unsigned int is_transient: 1; /* mono_metadata_free_mh () will actually free this header */
481         unsigned int num_clauses : 15;
482         /* if num_locals != 0, then the following apply: */
483         unsigned int init_locals : 1;
484         guint16      num_locals;
485         MonoExceptionClause *clauses;
486         MonoType    *locals [MONO_ZERO_LEN_ARRAY];
487 };
488
489 typedef struct {
490         guint32      code_size;
491         gboolean     has_clauses;
492 } MonoMethodHeaderSummary;
493
494 #define MONO_SIZEOF_METHOD_HEADER (sizeof (struct _MonoMethodHeader) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
495
496 struct _MonoMethodSignature {
497         MonoType     *ret;
498 #ifdef MONO_SMALL_CONFIG
499         guint8        param_count;
500         gint8         sentinelpos;
501         unsigned int  generic_param_count : 5;
502 #else
503         guint16       param_count;
504         gint16        sentinelpos;
505         unsigned int  generic_param_count : 16;
506 #endif
507         unsigned int  call_convention     : 6;
508         unsigned int  hasthis             : 1;
509         unsigned int  explicit_this       : 1;
510         unsigned int  pinvoke             : 1;
511         unsigned int  is_inflated         : 1;
512         unsigned int  has_type_parameters : 1;
513         MonoType     *params [MONO_ZERO_LEN_ARRAY];
514 };
515
516 #define MONO_SIZEOF_METHOD_SIGNATURE (sizeof (struct _MonoMethodSignature) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
517
518 /* for use with allocated memory blocks (assumes alignment is to 8 bytes) */
519 guint mono_aligned_addr_hash (gconstpointer ptr) MONO_INTERNAL;
520
521 void
522 mono_image_check_for_module_cctor (MonoImage *image) MONO_INTERNAL;
523
524 gpointer
525 mono_image_alloc  (MonoImage *image, guint size) MONO_INTERNAL;
526
527 gpointer
528 mono_image_alloc0 (MonoImage *image, guint size) MONO_INTERNAL;
529
530 #define mono_image_new0(image,type,size) ((type *) mono_image_alloc0 (image, sizeof (type)* (size)))
531
532 char*
533 mono_image_strdup (MonoImage *image, const char *s) MONO_INTERNAL;
534
535 GList*
536 g_list_prepend_image (MonoImage *image, GList *list, gpointer data) MONO_INTERNAL;
537
538 GSList*
539 g_slist_append_image (MonoImage *image, GSList *list, gpointer data) MONO_INTERNAL;
540
541 void
542 mono_image_lock (MonoImage *image) MONO_INTERNAL;
543
544 void
545 mono_image_unlock (MonoImage *image) MONO_INTERNAL;
546
547 gpointer
548 mono_image_property_lookup (MonoImage *image, gpointer subject, guint32 property) MONO_INTERNAL;
549
550 void
551 mono_image_property_insert (MonoImage *image, gpointer subject, guint32 property, gpointer value) MONO_INTERNAL;
552
553 void
554 mono_image_property_remove (MonoImage *image, gpointer subject) MONO_INTERNAL;
555
556 gboolean
557 mono_image_close_except_pools (MonoImage *image) MONO_INTERNAL;
558
559 void
560 mono_image_close_finish (MonoImage *image) MONO_INTERNAL;
561
562 typedef void  (*MonoImageUnloadFunc) (MonoImage *image, gpointer user_data);
563
564 void
565 mono_install_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data) MONO_INTERNAL;
566
567 void
568 mono_remove_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data) MONO_INTERNAL;
569
570 gpointer
571 mono_image_set_alloc  (MonoImageSet *set, guint size) MONO_INTERNAL;
572
573 gpointer
574 mono_image_set_alloc0 (MonoImageSet *set, guint size) MONO_INTERNAL;
575
576 char*
577 mono_image_set_strdup (MonoImageSet *set, const char *s) MONO_INTERNAL;
578
579 #define mono_image_set_new0(image,type,size) ((type *) mono_image_set_alloc0 (image, sizeof (type)* (size)))
580
581 MonoType*
582 mono_metadata_get_shared_type (MonoType *type) MONO_INTERNAL;
583
584 GSList*
585 mono_metadata_clean_for_image (MonoImage *image) MONO_INTERNAL;
586
587 void
588 mono_metadata_clean_generic_classes_for_image (MonoImage *image) MONO_INTERNAL;
589
590 void
591 mono_metadata_cleanup (void);
592
593 const char *   mono_meta_table_name              (int table) MONO_INTERNAL;
594 void           mono_metadata_compute_table_bases (MonoImage *meta) MONO_INTERNAL;
595
596 gboolean
597 mono_metadata_interfaces_from_typedef_full  (MonoImage             *image,
598                                                                                          guint32                table_index,
599                                                                                          MonoClass           ***interfaces,
600                                                                                          guint                 *count,
601                                                                                          gboolean               heap_alloc_result,
602                                                                                          MonoGenericContext    *context) MONO_INTERNAL;
603
604 MonoArrayType *
605 mono_metadata_parse_array_full              (MonoImage             *image,
606                                              MonoGenericContainer  *container,
607                                              const char            *ptr,
608                                              const char           **rptr) MONO_INTERNAL;
609
610 MonoType *
611 mono_metadata_parse_type_full               (MonoImage             *image,
612                                              MonoGenericContainer  *container,
613                                              MonoParseTypeMode      mode,
614                                              short                  opt_attrs,
615                                              const char            *ptr,
616                                              const char           **rptr);
617
618 MonoMethodSignature *
619 mono_metadata_parse_signature_full          (MonoImage             *image,
620                                              MonoGenericContainer  *generic_container,
621                                              guint32                token) MONO_INTERNAL;
622
623 MonoMethodSignature *
624 mono_metadata_parse_method_signature_full   (MonoImage             *image,
625                                              MonoGenericContainer  *generic_container,
626                                              int                     def,
627                                              const char             *ptr,
628                                              const char            **rptr);
629
630 MonoMethodHeader *
631 mono_metadata_parse_mh_full                 (MonoImage             *image,
632                                              MonoGenericContainer  *container,
633                                              const char            *ptr);
634
635 gboolean
636 mono_method_get_header_summary (MonoMethod *method, MonoMethodHeaderSummary *summary) MONO_INTERNAL;
637
638 int* mono_metadata_get_param_attrs          (MonoImage *m, int def, int param_count) MONO_INTERNAL;
639 gboolean mono_metadata_method_has_param_attrs (MonoImage *m, int def) MONO_INTERNAL;
640
641 guint
642 mono_metadata_generic_context_hash          (const MonoGenericContext *context) MONO_INTERNAL;
643
644 gboolean
645 mono_metadata_generic_context_equal         (const MonoGenericContext *g1,
646                                              const MonoGenericContext *g2) MONO_INTERNAL;
647
648 MonoGenericInst *
649 mono_metadata_parse_generic_inst            (MonoImage             *image,
650                                              MonoGenericContainer  *container,
651                                              int                    count,
652                                              const char            *ptr,
653                                              const char           **rptr) MONO_INTERNAL;
654
655 MonoGenericInst *
656 mono_metadata_get_generic_inst              (int                    type_argc,
657                                              MonoType             **type_argv) MONO_INTERNAL;
658
659 MonoGenericClass *
660 mono_metadata_lookup_generic_class          (MonoClass             *gclass,
661                                              MonoGenericInst       *inst,
662                                              gboolean               is_dynamic) MONO_INTERNAL;
663
664 MonoGenericInst * mono_metadata_inflate_generic_inst  (MonoGenericInst *ginst, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
665
666 void mono_dynamic_stream_reset  (MonoDynamicStream* stream) MONO_INTERNAL;
667 void mono_assembly_addref       (MonoAssembly *assembly) MONO_INTERNAL;
668 void mono_assembly_load_friends (MonoAssembly* ass) MONO_INTERNAL;
669 gboolean mono_assembly_has_skip_verification (MonoAssembly* ass) MONO_INTERNAL;
670
671 void mono_assembly_release_gc_roots (MonoAssembly *assembly) MONO_INTERNAL;
672 gboolean mono_assembly_close_except_image_pools (MonoAssembly *assembly) MONO_INTERNAL;
673 void mono_assembly_close_finish (MonoAssembly *assembly) MONO_INTERNAL;
674
675
676 gboolean mono_public_tokens_are_equal (const unsigned char *pubt1, const unsigned char *pubt2) MONO_INTERNAL;
677
678 void mono_config_parse_publisher_policy (const char *filename, MonoAssemblyBindingInfo *binding_info) MONO_INTERNAL;
679 void mono_config_parse_assembly_bindings (const char *filename, int major, int minor, void *user_data,
680                                           void (*infocb)(MonoAssemblyBindingInfo *info, void *user_data)) MONO_INTERNAL;
681
682 gboolean
683 mono_assembly_name_parse_full                (const char           *name,
684                                               MonoAssemblyName     *aname,
685                                               gboolean save_public_key,
686                                               gboolean *is_version_defined,
687                                                   gboolean *is_token_defined) MONO_INTERNAL;
688
689 guint32 mono_metadata_get_generic_param_row (MonoImage *image, guint32 token, guint32 *owner);
690
691 void mono_unload_interface_ids (MonoBitSet *bitset) MONO_INTERNAL;
692
693
694 MonoType *mono_metadata_type_dup (MonoImage *image, const MonoType *original) MONO_INTERNAL;
695 MonoMethodSignature  *mono_metadata_signature_dup_full (MonoImage *image,MonoMethodSignature *sig) MONO_INTERNAL;
696 MonoMethodSignature  *mono_metadata_signature_dup_mempool (MonoMemPool *mp, MonoMethodSignature *sig) MONO_INTERNAL;
697
698 MonoGenericInst *
699 mono_get_shared_generic_inst (MonoGenericContainer *container) MONO_INTERNAL;
700
701 int
702 mono_type_stack_size_internal (MonoType *t, int *align, gboolean allow_open) MONO_INTERNAL;
703
704 void            mono_type_get_desc (GString *res, MonoType *type, mono_bool include_namespace);
705
706 gboolean
707 mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, gboolean signature_only) MONO_INTERNAL;
708
709 MonoMarshalSpec *
710 mono_metadata_parse_marshal_spec_full (MonoImage *image, const char *ptr) MONO_INTERNAL;
711
712 guint          mono_metadata_generic_inst_hash (gconstpointer data) MONO_INTERNAL;
713 gboolean       mono_metadata_generic_inst_equal (gconstpointer ka, gconstpointer kb) MONO_INTERNAL;
714
715 void
716 mono_metadata_field_info_with_mempool (
717                                           MonoImage *meta, 
718                                       guint32       table_index,
719                                       guint32      *offset,
720                                       guint32      *rva,
721                                       MonoMarshalSpec **marshal_spec);
722
723 MonoClassField*
724 mono_metadata_get_corresponding_field_from_generic_type_definition (MonoClassField *field) MONO_INTERNAL;
725
726 MonoEvent*
727 mono_metadata_get_corresponding_event_from_generic_type_definition (MonoEvent *event) MONO_INTERNAL;
728
729 MonoProperty*
730 mono_metadata_get_corresponding_property_from_generic_type_definition (MonoProperty *property) MONO_INTERNAL;
731
732 guint32
733 mono_metadata_signature_size (MonoMethodSignature *sig) MONO_INTERNAL;
734
735 guint mono_metadata_str_hash (gconstpointer v1) MONO_INTERNAL;
736
737 gboolean mono_image_load_pe_data (MonoImage *image) MONO_INTERNAL;
738
739 gboolean mono_image_load_cli_data (MonoImage *image) MONO_INTERNAL;
740
741 void mono_image_load_names (MonoImage *image) MONO_INTERNAL;
742
743 MonoImage *mono_image_open_raw (const char *fname, MonoImageOpenStatus *status) MONO_INTERNAL;
744
745 MonoException *mono_get_exception_field_access_msg (const char *msg) MONO_INTERNAL;
746
747 MonoException *mono_get_exception_method_access_msg (const char *msg) MONO_INTERNAL;
748
749 MonoMethod* method_from_method_def_or_ref (MonoImage *m, guint32 tok, MonoGenericContext *context) MONO_INTERNAL;
750
751 MonoMethod *mono_get_method_constrained_with_method (MonoImage *image, MonoMethod *method, MonoClass *constrained_class, MonoGenericContext *context) MONO_INTERNAL;
752
753 #endif /* __MONO_METADATA_INTERNALS_H__ */
754