3 * Copyright 2015 Xamarin Inc
4 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
6 #ifndef __MONO_METADATA_ASSEMBLY_INTERNALS_H__
7 #define __MONO_METADATA_ASSEMBLY_INTERNALS_H__
11 #include <mono/metadata/assembly.h>
12 #include <mono/metadata/metadata-internals.h>
14 #ifndef ENABLE_NETCORE
15 #define MONO_ASSEMBLY_CORLIB_NAME "mscorlib"
17 #define MONO_ASSEMBLY_CORLIB_NAME "System.Private.CoreLib"
20 /* Flag bits for mono_assembly_names_equal_flags (). */
22 /* Default comparison: all fields must match */
23 MONO_ANAME_EQ_NONE
= 0x0,
24 /* Don't compare public key token */
25 MONO_ANAME_EQ_IGNORE_PUBKEY
= 0x1,
26 /* Don't compare the versions */
27 MONO_ANAME_EQ_IGNORE_VERSION
= 0x2,
28 /* When comparing simple names, ignore case differences */
29 MONO_ANAME_EQ_IGNORE_CASE
= 0x4,
31 MONO_ANAME_EQ_MASK
= 0x7
32 } MonoAssemblyNameEqFlags
;
35 mono_assembly_name_free_internal (MonoAssemblyName
*aname
);
38 mono_assembly_names_equal_flags (MonoAssemblyName
*l
, MonoAssemblyName
*r
, MonoAssemblyNameEqFlags flags
);
41 mono_assembly_get_assemblyref_checked (MonoImage
*image
, int index
, MonoAssemblyName
*aname
, MonoError
*error
);
43 MONO_API MonoImage
* mono_assembly_load_module_checked (MonoAssembly
*assembly
, uint32_t idx
, MonoError
*error
);
45 MonoAssembly
* mono_assembly_load_with_partial_name_internal (const char *name
, MonoImageOpenStatus
*status
);
48 typedef gboolean (*MonoAssemblyAsmCtxFromPathFunc
) (const char *absfname
, MonoAssembly
*requesting_assembly
, gpointer user_data
, MonoAssemblyContextKind
*out_asmctx
);
50 void mono_install_assembly_asmctx_from_path_hook (MonoAssemblyAsmCtxFromPathFunc func
, gpointer user_data
);
52 /* If predicate returns true assembly should be loaded, if false ignore it. */
53 typedef gboolean (*MonoAssemblyCandidatePredicate
)(MonoAssembly
*, gpointer
);
55 typedef struct MonoAssemblyLoadRequest
{
56 /* Assembly Load context that is requesting an assembly. */
57 MonoAssemblyContextKind asmctx
;
58 /* Predicate to apply to candidate assemblies. Optional. */
59 MonoAssemblyCandidatePredicate predicate
;
60 /* user_data for predicate. Optional. */
61 gpointer predicate_ud
;
62 } MonoAssemblyLoadRequest
;
64 typedef struct MonoAssemblyOpenRequest
{
65 MonoAssemblyLoadRequest request
;
66 /* Assembly that is requesting the wanted assembly. Optional. */
67 MonoAssembly
*requesting_assembly
;
68 } MonoAssemblyOpenRequest
;
70 typedef struct MonoAssemblyByNameRequest
{
71 MonoAssemblyLoadRequest request
;
72 /* Assembly that is requesting the wanted assembly name. Optional.
73 * If no_postload_search is TRUE, requesting_assembly is not used.
75 MonoAssembly
*requesting_assembly
;
76 /* basedir to probe for the wanted assembly name. Optional. */
78 gboolean no_postload_search
; /* FALSE is usual */
79 /* FIXME: predicate unused? */
80 } MonoAssemblyByNameRequest
;
82 void mono_assembly_request_prepare (MonoAssemblyLoadRequest
*req
,
84 MonoAssemblyContextKind asmctx
);
86 MonoAssembly
* mono_assembly_request_open (const char *filename
,
87 const MonoAssemblyOpenRequest
*req
,
88 MonoImageOpenStatus
*status
);
90 MonoAssembly
* mono_assembly_request_load_from (MonoImage
*image
, const char *fname
,
91 const MonoAssemblyLoadRequest
*req
,
92 MonoImageOpenStatus
*status
);
94 MonoAssembly
* mono_assembly_request_byname (MonoAssemblyName
*aname
,
95 const MonoAssemblyByNameRequest
*req
,
96 MonoImageOpenStatus
*status
);
98 /* MonoAssemblyCandidatePredicate that compares the assembly name (name, version,
99 * culture, public key token) of the candidate with the wanted name, if the
100 * wanted name has a public key token (if not present, always return true).
101 * Pass the wanted MonoAssemblyName* as the user_data.
104 mono_assembly_candidate_predicate_sn_same_name (MonoAssembly
*candidate
, gpointer wanted_name
);
107 mono_assembly_binding_applies_to_image (MonoImage
* image
, MonoImageOpenStatus
*status
);
110 mono_assembly_load_from_assemblies_path (gchar
**assemblies_path
, MonoAssemblyName
*aname
, MonoAssemblyContextKind asmctx
);
112 MONO_PROFILER_API MonoAssemblyName
*
113 mono_assembly_get_name_internal (MonoAssembly
*assembly
);
115 MONO_PROFILER_API MonoImage
*
116 mono_assembly_get_image_internal (MonoAssembly
*assembly
);
118 #endif /* __MONO_METADATA_ASSEMBLY_INTERNALS_H__ */