*
* Copyright 2001-2004 Ximian, Inc.
* Copyright 2004-2009 Novell, Inc.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include "config.h"
#include "mono/utils/mono-dl.h"
if (!endp)
return NULL;
*endp = 0;
- return g_memdup (startp, (endp - startp) + 1);
+ return (char *) g_memdup (startp, (endp - startp) + 1);
}
if (*p == 0)
return NULL;
while (*p && !isspace (*p))
++p;
*p = 0;
- return g_memdup (startp, (p - startp) + 1);
+ return (char *) g_memdup (startp, (p - startp) + 1);
}
/*
if (error_msg)
*error_msg = NULL;
- module = malloc (sizeof (MonoDl));
+ module = (MonoDl *) g_malloc (sizeof (MonoDl));
if (!module) {
if (error_msg)
*error_msg = g_strdup ("Out of memory");
const char *ext;
/* This platform does not support dlopen */
if (name == NULL) {
- free (module);
+ g_free (module);
return NULL;
}
if (error_msg) {
*error_msg = mono_dl_current_error_string ();
}
- free (module);
+ g_free (module);
return NULL;
}
}
} else {
#if MONO_DL_NEED_USCORE
{
- char *usname = malloc (strlen (name) + 2);
+ char *usname = g_malloc (strlen (name) + 2);
*usname = '_';
strcpy (usname + 1, name);
sym = mono_dl_lookup_symbol (module, usname);
- free (usname);
+ g_free (usname);
}
#else
sym = mono_dl_lookup_symbol (module, name);
} else
mono_dl_close_handle (module);
- free (module);
+ g_free (module);
}
/**
if (binl != -1) {
char *base;
char *resolvedname, *name;
+ char *baseparent = NULL;
buf [binl] = 0;
resolvedname = mono_path_resolve_symlinks (buf);
base = g_path_get_dirname (resolvedname);
name = g_strdup_printf ("%s/.libs", base);
runtime_lib = try_load (lib_name, name, flags, error_msg);
g_free (name);
+ if (!runtime_lib)
+ baseparent = g_path_get_dirname (base);
if (!runtime_lib) {
- char *newbase = g_path_get_dirname (base);
- name = g_strdup_printf ("%s/lib", newbase);
+ name = g_strdup_printf ("%s/lib", baseparent);
runtime_lib = try_load (lib_name, name, flags, error_msg);
g_free (name);
}
#ifdef __MACH__
if (!runtime_lib) {
- char *newbase = g_path_get_dirname (base);
- name = g_strdup_printf ("%s/Libraries", newbase);
+ name = g_strdup_printf ("%s/Libraries", baseparent);
runtime_lib = try_load (lib_name, name, flags, error_msg);
g_free (name);
}
#endif
+ if (!runtime_lib) {
+ name = g_strdup_printf ("%s/profiler/.libs", baseparent);
+ runtime_lib = try_load (lib_name, name, flags, error_msg);
+ g_free (name);
+ }
g_free (base);
g_free (resolvedname);
+ g_free (baseparent);
}
if (!runtime_lib)
runtime_lib = try_load (lib_name, NULL, flags, error_msg);