3 * Interface to the dynamic linker
6 * Mono Team (http://www.mono-project.com)
8 * Copyright 2001-2004 Ximian, Inc.
9 * Copyright 2004-2009 Novell, Inc.
10 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
18 #if defined(_POSIX_VERSION) && !defined (HOST_WASM)
20 #include "mono/utils/mono-dl.h"
21 #include "mono/utils/mono-embed.h"
22 #include "mono/utils/mono-path.h"
31 #if !defined (TARGET_MACH)
33 mono_dl_get_so_prefix (void)
38 mono_dl_get_so_suffixes (void)
40 static const char *suffixes[] = {
48 mono_dl_get_executable_path (char *buf, int buflen)
50 return readlink ("/proc/self/exe", buf, buflen - 1);
54 mono_dl_get_system_dir (void)
62 mono_dl_open_file (const char *file, int flags)
65 /* Bionic doesn't support NULL filenames */
69 return dlopen (file, flags);
73 mono_dl_close_handle (MonoDl *module)
75 dlclose (module->handle);
79 mono_dl_lookup_symbol (MonoDl *module, const char *name)
81 return dlsym (module->handle, name);
85 mono_dl_convert_flags (int flags)
87 int lflags = flags & MONO_DL_LOCAL? 0: RTLD_GLOBAL;
89 if (flags & MONO_DL_LAZY)
97 mono_dl_current_error_string (void)
99 return g_strdup (dlerror ());