[runtime] Prioritize loading a profiler library from the installation dir over standa...
[mono.git] / mono / metadata / profiler.c
index dccf09307119dae0221e9cce91dba789ff876dc5..05e8d367a8bdf3a021b697608ec9e61f78f6c4ad 100644 (file)
@@ -936,11 +936,11 @@ mono_profiler_install_iomap (MonoProfileIomapFunc callback)
 }
 
 void
-mono_profiler_code_buffer_new (gpointer buffer, int size, MonoProfilerCodeBufferType type, void *data) {
+mono_profiler_code_buffer_new (gpointer buffer, int size, MonoProfilerCodeBufferType type, gconstpointer data) {
        ProfilerDesc *prof;
        for (prof = prof_list; prof; prof = prof->next) {
                if (prof->code_buffer_new)
-                       prof->code_buffer_new (prof->profiler, buffer, size, type, data);
+                       prof->code_buffer_new (prof->profiler, buffer, size, type, (void*)data);
        }
 }
 
@@ -1196,17 +1196,15 @@ mono_profiler_load (const char *desc)
                }
                if (!load_embedded_profiler (desc, mname)) {
                        libname = g_strdup_printf ("mono-profiler-%s", mname);
-                       if (!load_profiler_from_directory (NULL, libname, desc)) {
-                               res = FALSE;
 #if defined (MONO_ASSEMBLIES)
-                               res = load_profiler_from_directory (mono_assembly_getrootdir (), libname, desc);
+                       res = load_profiler_from_directory (mono_assembly_getrootdir (), libname, desc);
 #endif
-                               if (!res)
-                                       res = load_profiler_from_mono_instalation (libname, desc);
-
-                               if (!res)
-                                       g_warning ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname);
-                       }
+                       if (!res)
+                               res = load_profiler_from_directory (NULL, libname, desc);
+                       if (!res)
+                               res = load_profiler_from_mono_instalation (libname, desc);
+                       if (!res)
+                               g_warning ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname);
                        g_free (libname);
                }
                g_free (mname);