2 * mono-dl.c: Interface to the dynamic linker
5 * Mono Team (http://www.mono-project.com)
7 * Copyright 2001-2004 Ximian, Inc.
8 * Copyright 2004-2009 Novell, Inc.
16 #if defined(_POSIX_VERSION)
18 #include "mono/utils/mono-dl.h"
19 #include "mono/utils/mono-embed.h"
20 #include "mono/utils/mono-path.h"
29 #if !defined (TARGET_MACH)
31 mono_dl_get_so_prefix (void)
36 mono_dl_get_so_suffixes (void)
38 static const char *suffixes[] = {
46 mono_dl_get_executable_path (char *buf, int buflen)
48 return readlink ("/proc/self/exe", buf, buflen - 1);
53 mono_dl_open_file (const char *file, int flags)
55 #ifdef PLATFORM_ANDROID
56 /* Bionic doesn't support NULL filenames */
60 return dlopen (file, flags);
64 mono_dl_close_handle (MonoDl *module)
66 dlclose (module->handle);
70 mono_dl_lookup_symbol (MonoDl *module, const char *name)
72 return dlsym (module->handle, name);
76 mono_dl_convert_flags (int flags)
78 int lflags = flags & MONO_DL_LOCAL? 0: RTLD_GLOBAL;
80 if (flags & MONO_DL_LAZY)
88 mono_dl_current_error_string (void)
90 return g_strdup (dlerror ());