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);
52 mono_dl_get_system_dir (void)
60 mono_dl_open_file (const char *file, int flags)
62 #ifdef PLATFORM_ANDROID
63 /* Bionic doesn't support NULL filenames */
67 return dlopen (file, flags);
71 mono_dl_close_handle (MonoDl *module)
73 dlclose (module->handle);
77 mono_dl_lookup_symbol (MonoDl *module, const char *name)
79 return dlsym (module->handle, name);
83 mono_dl_convert_flags (int flags)
85 int lflags = flags & MONO_DL_LOCAL? 0: RTLD_GLOBAL;
87 if (flags & MONO_DL_LAZY)
95 mono_dl_current_error_string (void)
97 return g_strdup (dlerror ());