[netcore] Make the load hook ALC-aware (#16012)
[mono-project.git] / mono / metadata / loader-internals.h
blob9d61ed424514da46b8fc972682847ea01a8c6331
1 /**
2 * \file
3 */
5 #ifndef _MONO_METADATA_LOADER_INTERNALS_H_
6 #define _MONO_METADATA_LOADER_INTERNALS_H_
8 #include <glib.h>
9 #include <mono/metadata/appdomain.h>
10 #include <mono/metadata/image.h>
11 #include <mono/metadata/object-forward.h>
12 #include <mono/utils/mono-forward.h>
13 #include <mono/utils/mono-error.h>
14 #include <mono/utils/mono-coop-mutex.h>
16 typedef struct _MonoLoadedImages MonoLoadedImages;
17 typedef struct _MonoAssemblyLoadContext MonoAssemblyLoadContext;
19 #ifdef ENABLE_NETCORE
20 /* FIXME: this probably belongs somewhere else */
21 struct _MonoAssemblyLoadContext {
22 MonoDomain *domain;
23 MonoLoadedImages *loaded_images;
24 GSList *loaded_assemblies;
25 MonoCoopMutex assemblies_lock;
26 /* Handle of the corresponding managed object. If the ALC is
27 * collectible, the handle is weak, otherwise it's strong.
29 uint32_t gchandle;
31 #endif /* ENABLE_NETCORE */
33 gpointer
34 mono_lookup_pinvoke_call_internal (MonoMethod *method, MonoError *error);
36 #ifdef ENABLE_NETCORE
37 void
38 mono_set_pinvoke_search_directories (int dir_count, char **dirs);
40 void
41 mono_alc_init (MonoAssemblyLoadContext *alc, MonoDomain *domain);
43 void
44 mono_alc_cleanup (MonoAssemblyLoadContext *alc);
46 void
47 mono_alc_assemblies_lock (MonoAssemblyLoadContext *alc);
49 void
50 mono_alc_assemblies_unlock (MonoAssemblyLoadContext *alc);
52 gboolean
53 mono_alc_is_default (MonoAssemblyLoadContext *alc);
55 MonoAssembly*
56 mono_alc_invoke_resolve_using_load_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname);
58 MonoAssembly*
59 mono_alc_invoke_resolve_using_resolving_event_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname);
61 MonoAssembly*
62 mono_alc_invoke_resolve_using_resolve_satellite_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname);
64 #endif /* ENABLE_NETCORE */
66 static inline MonoDomain *
67 mono_alc_domain (MonoAssemblyLoadContext *alc)
69 #ifdef ENABLE_NETCORE
70 return alc->domain;
71 #else
72 return mono_domain_get ();
73 #endif
76 MonoLoadedImages *
77 mono_alc_get_loaded_images (MonoAssemblyLoadContext *alc);
79 #endif