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.
9 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
17 #if defined(_POSIX_VERSION)
19 #include "mono/utils/mono-dl.h"
20 #include "mono/utils/mono-embed.h"
21 #include "mono/utils/mono-path.h"
30 #if !defined (TARGET_MACH)
32 mono_dl_get_so_prefix (void)
37 mono_dl_get_so_suffixes (void)
39 static const char *suffixes[] = {
47 mono_dl_get_executable_path (char *buf, int buflen)
49 return readlink ("/proc/self/exe", buf, buflen - 1);
53 mono_dl_get_system_dir (void)
61 mono_dl_open_file (const char *file, int flags)
63 #ifdef PLATFORM_ANDROID
64 /* Bionic doesn't support NULL filenames */
68 return dlopen (file, flags);
72 mono_dl_close_handle (MonoDl *module)
74 dlclose (module->handle);
78 mono_dl_lookup_symbol (MonoDl *module, const char *name)
80 return dlsym (module->handle, name);
84 mono_dl_convert_flags (int flags)
86 int lflags = flags & MONO_DL_LOCAL? 0: RTLD_GLOBAL;
88 if (flags & MONO_DL_LAZY)
96 mono_dl_current_error_string (void)
98 return g_strdup (dlerror ());