[netcore] Implement Thread.GetCurrentProcessorId (#18450)
[mono-project.git] / mono / metadata / loader-internals.h
blob55519c4433194714051fb17ddebccc3e6aaa6005
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 #ifndef DISABLE_DLLMAP
20 typedef struct _MonoDllMap MonoDllMap;
21 struct _MonoDllMap {
22 char *dll;
23 char *target;
24 char *func;
25 char *target_func;
26 MonoDllMap *next;
28 #endif
30 #ifdef ENABLE_NETCORE
31 /* FIXME: this probably belongs somewhere else */
32 struct _MonoAssemblyLoadContext {
33 MonoDomain *domain;
34 MonoLoadedImages *loaded_images;
35 GSList *loaded_assemblies;
36 MonoCoopMutex assemblies_lock;
37 /* Handle of the corresponding managed object. If the ALC is
38 * collectible, the handle is weak, otherwise it's strong.
40 uint32_t gchandle;
42 // Used in native-library.c for the hash table below; do not access anywhere else
43 MonoCoopMutex pinvoke_lock;
44 // Maps malloc-ed char* pinvoke scope -> MonoDl*
45 GHashTable *pinvoke_scopes;
47 #endif /* ENABLE_NETCORE */
49 void
50 mono_global_loader_data_lock (void);
52 void
53 mono_global_loader_data_unlock (void);
55 gpointer
56 mono_lookup_pinvoke_call_internal (MonoMethod *method, MonoError *error);
58 #ifndef DISABLE_DLLMAP
59 void
60 mono_dllmap_insert_internal (MonoImage *assembly, const char *dll, const char *func, const char *tdll, const char *tfunc);
62 void
63 mono_global_dllmap_cleanup (void);
64 #endif
66 void
67 mono_global_loader_cache_init (void);
69 void
70 mono_global_loader_cache_cleanup (void);
72 #ifdef ENABLE_NETCORE
73 void
74 mono_set_pinvoke_search_directories (int dir_count, char **dirs);
76 void
77 mono_alc_init (MonoAssemblyLoadContext *alc, MonoDomain *domain);
79 void
80 mono_alc_cleanup (MonoAssemblyLoadContext *alc);
82 void
83 mono_alc_assemblies_lock (MonoAssemblyLoadContext *alc);
85 void
86 mono_alc_assemblies_unlock (MonoAssemblyLoadContext *alc);
88 gboolean
89 mono_alc_is_default (MonoAssemblyLoadContext *alc);
91 MonoAssembly*
92 mono_alc_invoke_resolve_using_load_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname);
94 MonoAssembly*
95 mono_alc_invoke_resolve_using_resolving_event_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname);
97 MonoAssembly*
98 mono_alc_invoke_resolve_using_resolve_satellite_nofail (MonoAssemblyLoadContext *alc, MonoAssemblyName *aname);
100 #endif /* ENABLE_NETCORE */
102 static inline MonoDomain *
103 mono_alc_domain (MonoAssemblyLoadContext *alc)
105 #ifdef ENABLE_NETCORE
106 return alc->domain;
107 #else
108 return mono_domain_get ();
109 #endif
112 MonoLoadedImages *
113 mono_alc_get_loaded_images (MonoAssemblyLoadContext *alc);
115 MONO_API void
116 mono_loader_save_bundled_library (int fd, uint64_t offset, uint64_t size, const char *destfname);
118 #endif