return FALSE;
} else {
g_message ("Unknown heap type: %s\n", ptr + 8);
- ptr += 8 + strlen (ptr) + 1;
+ ptr += 8 + strlen (ptr + 8) + 1;
}
pad = ptr - image->raw_metadata;
if (pad % 4)
image->remoting_invoke_cache = g_hash_table_new (NULL, NULL);
image->synchronized_cache = g_hash_table_new (NULL, NULL);
- image->generics_cache = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GEqualFunc)mono_metadata_type_equal);
image->typespec_cache = g_hash_table_new (NULL, NULL);
+
+ image->generic_inst_cache =
+ g_hash_table_new ((GHashFunc)mono_metadata_generic_inst_hash,
+ (GCompareFunc)mono_metadata_generic_inst_equal);
}
static MonoImage *
image = g_new0 (MonoImage, 1);
image->ref_count = 1;
image->f = filed;
- image->name = g_strdup (fname);
iinfo = g_new0 (MonoCLIImageInfo, 1);
image->image_info = iinfo;
+ if (g_path_is_absolute (fname))
+ image->name = g_strdup (fname);
+ else {
+ gchar *path = g_get_current_dir ();
+ image->name = g_build_filename (path, fname, NULL);
+ g_free (path);
+ }
+
return do_mono_image_load (image, status);
}
{
MonoImage *res;
- if (strcmp (name, "corlib") == 0)
- name = "mscorlib";
-
EnterCriticalSection (&images_mutex);
res = g_hash_table_lookup (loaded_images_hash, name);
LeaveCriticalSection (&images_mutex);
g_hash_table_destroy ((GHashTable*)val);
}
+/**
+ * mono_image_close:
+ * @image: The image file we wish to add a reference to
+ *
+ * Increases the reference count of an image.
+ */
+void
+mono_image_addref (MonoImage *image)
+{
+ InterlockedIncrement (&image->ref_count);
+}
+
/**
* mono_image_close:
* @image: The image file we wish to close
g_hash_table_destroy (image->delegate_invoke_cache);
g_hash_table_destroy (image->remoting_invoke_cache);
g_hash_table_destroy (image->runtime_invoke_cache);
+ g_hash_table_destroy (image->typespec_cache);
+ g_hash_table_destroy (image->generic_inst_cache);
if (image->raw_metadata != NULL)
mono_raw_buffer_free (image->raw_metadata);