#include <mono/metadata/mono-config.h>
#include <mono/metadata/mono-config-dirs.h>
#include <mono/utils/mono-digest.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
#include <mono/utils/mono-path.h>
#include <mono/metadata/reflection.h>
#include <mono/metadata/coree.h>
#include <mono/metadata/cil-coff.h>
#include <mono/utils/mono-io-portability.h>
#include <mono/utils/atomic.h>
-#include <mono/utils/mono-mutex.h>
+#include <mono/utils/mono-os-mutex.h>
#ifndef HOST_WIN32
#include <sys/types.h>
static char* unquote (const char *str);
/* This protects loaded_assemblies and image->references */
-#define mono_assemblies_lock() mono_mutex_lock (&assemblies_mutex)
-#define mono_assemblies_unlock() mono_mutex_unlock (&assemblies_mutex)
+#define mono_assemblies_lock() mono_os_mutex_lock (&assemblies_mutex)
+#define mono_assemblies_unlock() mono_os_mutex_unlock (&assemblies_mutex)
static mono_mutex_t assemblies_mutex;
/* If defined, points to the bundled assembly information */
gchar *res;
int i;
- res = g_malloc (len * 2 + 1);
+ res = (gchar *)g_malloc (len * 2 + 1);
for (i = 0; i < len; i++) {
res [i * 2] = allowed [token [i] >> 4];
res [i * 2 + 1] = allowed [token [i] & 0xF];
check_path_env ();
check_extra_gac_path_env ();
- mono_mutex_init_recursive (&assemblies_mutex);
- mono_mutex_init (&assembly_binding_mutex);
+ mono_os_mutex_init_recursive (&assemblies_mutex);
+ mono_os_mutex_init (&assembly_binding_mutex);
}
static void
mono_assembly_binding_lock (void)
{
- mono_locks_mutex_acquire (&assembly_binding_mutex, AssemblyBindingLock);
+ mono_locks_os_acquire (&assembly_binding_mutex, AssemblyBindingLock);
}
static void
mono_assembly_binding_unlock (void)
{
- mono_locks_mutex_release (&assembly_binding_mutex, AssemblyBindingLock);
+ mono_locks_os_release (&assembly_binding_mutex, AssemblyBindingLock);
}
gboolean
aname->revision = cols [MONO_ASSEMBLY_REV_NUMBER];
aname->hash_alg = cols [MONO_ASSEMBLY_HASH_ALG];
if (cols [MONO_ASSEMBLY_PUBLIC_KEY]) {
- guchar* token = g_malloc (8);
+ guchar* token = (guchar *)g_malloc (8);
gchar* encoded;
const gchar* pkey;
int len;
* a non loaded reference using the ReflectionOnly api
*/
if (!reference)
- reference = REFERENCE_MISSING;
+ reference = (MonoAssembly *)REFERENCE_MISSING;
} else {
/* we first try without setting the basedir: this can eventually result in a ResolveAssembly
* event which is the MS .net compatible behaviour (the assemblyresolve_event3.cs test has been fixed
mono_assemblies_lock ();
if (reference == NULL) {
/* Flag as not found */
- reference = REFERENCE_MISSING;
+ reference = (MonoAssembly *)REFERENCE_MISSING;
}
if (!image->references [index]) {
image = NULL;
+ // If VM built with mkbundle
loaded_from_bundle = FALSE;
if (bundles != NULL) {
image = mono_assembly_open_from_bundle (fname, status, refonly);
/* Encode the size of the blob */
offset = 0;
if (keylen <= 127) {
- arr = g_malloc (keylen + 1);
+ arr = (gchar *)g_malloc (keylen + 1);
arr [offset++] = keylen;
} else {
- arr = g_malloc (keylen + 2);
+ arr = (gchar *)g_malloc (keylen + 2);
arr [offset++] = 0x80; /* 10bs */
arr [offset++] = keylen;
}
if (strstr (aname->name, ".dll")) {
len = strlen (aname->name) - 4;
- name = g_malloc (len);
+ name = (gchar *)g_malloc (len);
strncpy (name, aname->name, len);
} else
name = g_strdup (aname->name);
GSList *tmp;
for (tmp = loaded_assembly_bindings; tmp; tmp = tmp->next) {
- MonoAssemblyBindingInfo *info = tmp->data;
+ MonoAssemblyBindingInfo *info = (MonoAssemblyBindingInfo *)tmp->data;
if (assembly_binding_maps_name (info, aname))
return info;
}
return;
for (tmp = domain->assembly_bindings; tmp; tmp = tmp->next) {
- info_tmp = tmp->data;
+ info_tmp = (MonoAssemblyBindingInfo *)tmp->data;
if (strcmp (info->name, info_tmp->name) == 0 && info_versions_equal (info, info_tmp))
return;
}
- info_copy = mono_mempool_alloc0 (domain->mp, sizeof (MonoAssemblyBindingInfo));
+ info_copy = (MonoAssemblyBindingInfo *)mono_mempool_alloc0 (domain->mp, sizeof (MonoAssemblyBindingInfo));
memcpy (info_copy, info, sizeof (MonoAssemblyBindingInfo));
if (info->name)
info_copy->name = mono_mempool_strdup (domain->mp, info->name);
info = NULL;
for (list = domain->assembly_bindings; list; list = list->next) {
- info = list->data;
+ info = (MonoAssemblyBindingInfo *)list->data;
if (info && !strcmp (aname->name, info->name) && info_major_minor_in_range (info, aname))
break;
info = NULL;
info2 = get_per_domain_assembly_binding_info (domain, aname);
if (info2) {
- info = g_memdup (info2, sizeof (MonoAssemblyBindingInfo));
+ info = (MonoAssemblyBindingInfo *)g_memdup (info2, sizeof (MonoAssemblyBindingInfo));
info->name = g_strdup (info2->name);
info->culture = g_strdup (info2->culture);
info->domain_id = domain->domain_id;
if (strstr (aname->name, ".dll")) {
len = strlen (filename) - 4;
- name = g_malloc (len);
+ name = (gchar *)g_malloc (len);
strncpy (name, aname->name, len);
} else {
name = g_strdup (aname->name);
return corlib;
}
+ // In native client, Corlib is embedded in the executable as static variable corlibData
#if defined(__native_client__)
if (corlibData != NULL && corlibSize != 0) {
int status = 0;
}
#endif
+ // A nonstandard preload hook may provide a special mscorlib assembly
aname = mono_assembly_name_new ("mscorlib.dll");
corlib = invoke_assembly_preload_hook (aname, assemblies_path);
mono_assembly_name_free (aname);
if (corlib != NULL)
return corlib;
- if (assemblies_path) {
+ // This unusual directory layout can occur if mono is being built and run out of its own source repo
+ if (assemblies_path) { // Custom assemblies path set via MONO_PATH or mono_set_assemblies_path
corlib = load_in_path ("mscorlib.dll", (const char**)assemblies_path, status, FALSE);
if (corlib)
return corlib;
}
- /* Load corlib from mono/<version> */
-
+ /* Normal case: Load corlib from mono/<version> */
corlib_file = g_build_filename ("mono", runtime->framework_version, "mscorlib.dll", NULL);
- if (assemblies_path) {
+ if (assemblies_path) { // Custom assemblies path
corlib = load_in_path (corlib_file, (const char**)assemblies_path, status, FALSE);
if (corlib) {
g_free (corlib_file);
assembly->image = NULL;
for (tmp = assembly->friend_assembly_names; tmp; tmp = tmp->next) {
- MonoAssemblyName *fname = tmp->data;
+ MonoAssemblyName *fname = (MonoAssemblyName *)tmp->data;
mono_assembly_name_free (fname);
g_free (fname);
}
{
GSList *l;
- mono_mutex_destroy (&assemblies_mutex);
- mono_mutex_destroy (&assembly_binding_mutex);
+ mono_os_mutex_destroy (&assemblies_mutex);
+ mono_os_mutex_destroy (&assembly_binding_mutex);
for (l = loaded_assembly_bindings; l; l = l->next) {
- MonoAssemblyBindingInfo *info = l->data;
+ MonoAssemblyBindingInfo *info = (MonoAssemblyBindingInfo *)l->data;
mono_assembly_binding_info_free (info);
g_free (info);
iter = &loaded_assembly_bindings;
while (*iter) {
GSList *l = *iter;
- MonoAssemblyBindingInfo *info = l->data;
+ MonoAssemblyBindingInfo *info = (MonoAssemblyBindingInfo *)l->data;
if (info->domain_id == domain_id) {
*iter = l->next;