This should make it easier to programmatically check for errors, since it will remove the need to test the output string, which is an unreliable way of doing things.
*
* Disassembles the @file file.
*/
*
* Disassembles the @file file.
*/
disassemble_file (const char *file)
{
MonoImageOpenStatus status;
disassemble_file (const char *file)
{
MonoImageOpenStatus status;
img = mono_image_open (file, &status);
if (!img) {
fprintf (stderr, "Error while trying to process %s\n", file);
img = mono_image_open (file, &status);
if (!img) {
fprintf (stderr, "Error while trying to process %s\n", file);
} else {
/* FIXME: is this call necessary? */
mono_assembly_load_from_full (img, file, &status, FALSE);
} else {
/* FIXME: is this call necessary? */
mono_assembly_load_from_full (img, file, &status, FALSE);
}
mono_image_close (img);
}
mono_image_close (img);
mono_install_assembly_preload_hook (monodis_preload, GUINT_TO_POINTER (FALSE));
mono_install_assembly_preload_hook (monodis_preload, GUINT_TO_POINTER (FALSE));
- disassemble_file (filename);
+ return disassemble_file (filename);
} else {
mono_init (argv [0]);
} else {
mono_init (argv [0]);
for (l = input_files; l; l = l->next)
for (l = input_files; l; l = l->next)
- disassemble_file ((const char *)l->data);
+ if (disassemble_file ((const char *)l->data) == 1) i = 1;
+ return i;