return FALSE;
}
+static gboolean
+load_profiler_from_mono_instalation (const char *libname, const char *desc)
+{
+ char *err = NULL;
+ MonoDl *pmodule = mono_dl_open_runtime_lib (libname, MONO_DL_LAZY, &err);
+ g_free (err);
+ if (pmodule)
+ return load_profiler (pmodule, desc, INITIALIZER_NAME);
+ return FALSE;
+}
+
/**
* mono_profiler_load:
* @desc: arguments to configure the profiler
const char* col = strchr (desc, ':');
char* libname;
char *mname;
- gboolean res;
+ gboolean res = FALSE;
if (col != NULL) {
mname = g_memdup (desc, col - desc + 1);
}
if (!load_embedded_profiler (desc, mname)) {
libname = g_strdup_printf ("mono-profiler-%s", mname);
- if (!load_profiler_from_directory (NULL, libname, desc))
+ if (!load_profiler_from_directory (NULL, libname, desc)) {
+ res = FALSE;
#if defined (MONO_ASSEMBLIES)
res = load_profiler_from_directory (mono_assembly_getrootdir (), libname, desc);
-#else
- res = FALSE;
#endif
if (!res)
- g_warning ("The %s profiler wasn't found in the main executable nor could it be loaded from '%s'.", libname);
+ 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);