#define SO_HANDLE_TYPE HMODULE
#define LL_SO_OPEN(file,flags) (file)? LoadLibrary ((file)): GetModuleHandle (NULL)
-#define LL_SO_CLOSE(module) do { if ((module)->main_module) FreeLibrary ((module)->handle); } while (0)
-#define LL_SO_SYMBOL(handle, name) GetProcAddress ((handle), (name))
+#define LL_SO_CLOSE(module) do { if (!(module)->main_module) FreeLibrary ((module)->handle); } while (0)
+#define LL_SO_SYMBOL(module, name) GetProcAddress ((module)->handle, (name))
#define LL_SO_TRFLAGS(flags) 0
#define LL_SO_ERROR() w32_dlerror ()
#define SO_HANDLE_TYPE void*
#define LL_SO_OPEN(file,flags) dlopen ((file), (flags))
-#define LL_SO_CLOSE(handle) dlclose ((handle))
-#define LL_SO_SYMBOL(handle, name) dlsym ((handle), (name))
+#define LL_SO_CLOSE(module) dlclose ((module)->handle)
+#define LL_SO_SYMBOL(module, name) dlsym ((module)->handle, (name))
#define LL_SO_TRFLAGS(flags) convert_flags ((flags))
#define LL_SO_ERROR() g_strdup (dlerror ())
/* no duynamic loader supported */
#define SO_HANDLE_TYPE void*
#define LL_SO_OPEN(file,flags) NULL
-#define LL_SO_CLOSE(handle)
-#define LL_SO_SYMBOL(handle, name) NULL
+#define LL_SO_CLOSE(module)
+#define LL_SO_SYMBOL(module, name) NULL
#define LL_SO_TRFLAGS(flags) (flags)
#define LL_SO_ERROR() g_strdup ("No support for dynamic loader")
char *usname = malloc (strlen (name) + 2);
*usname = '_';
strcpy (usname + 1, name);
- sym = LL_SO_SYMBOL (module->handle, usname);
+ sym = LL_SO_SYMBOL (module, usname);
free (usname);
}
#else
- sym = LL_SO_SYMBOL (module->handle, name);
+ sym = LL_SO_SYMBOL (module, name);
#endif
if (sym) {
if (symbol)
#ifndef __MONO_UTILS_DL_H__
#define __MONO_UTILS_DL_H__
+#include "mono/utils/mono-compiler.h"
+
enum {
MONO_DL_LAZY = 1,
MONO_DL_LOCAL = 2,
typedef struct _MonoDl MonoDl;
-MonoDl* mono_dl_open (const char *name, int flags, char **error_msg);
-char* mono_dl_symbol (MonoDl *module, const char *name, void **symbol);
-void mono_dl_close (MonoDl *module);
+MonoDl* mono_dl_open (const char *name, int flags, char **error_msg) MONO_INTERNAL;
+char* mono_dl_symbol (MonoDl *module, const char *name, void **symbol) MONO_INTERNAL;
+void mono_dl_close (MonoDl *module) MONO_INTERNAL;
-char* mono_dl_build_path (const char *directory, const char *name, void **iter);
+char* mono_dl_build_path (const char *directory, const char *name, void **iter) MONO_INTERNAL;
#endif /* __MONO_UTILS_DL_H__ */