Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / utils / mono-dl.h
1 /**
2  * \file
3  */
4
5 #ifndef __MONO_UTILS_DL_H__
6 #define __MONO_UTILS_DL_H__
7
8 #include "mono/utils/mono-compiler.h"
9 #include "mono/utils/mono-dl-fallback.h"
10
11 #ifdef TARGET_WIN32
12 #define MONO_SOLIB_EXT ".dll"
13 #elif defined(__ppc__) && defined(TARGET_MACH)
14 #define MONO_SOLIB_EXT ".dylib"
15 #elif defined(TARGET_MACH) && defined(TARGET_X86)
16 #define MONO_SOLIB_EXT ".dylib"
17 #elif defined(TARGET_MACH) && defined(TARGET_AMD64)
18 #define MONO_SOLIB_EXT ".dylib"
19 #else
20 #define MONO_SOLIB_EXT ".so"
21 #endif
22
23 typedef struct {
24         void *handle;
25         int main_module;
26
27         /* If not NULL, use the methods in MonoDlFallbackHandler instead of the LL_* methods */
28         MonoDlFallbackHandler *dl_fallback;
29 } MonoDl;
30
31
32 MONO_API MonoDl*     mono_dl_open       (const char *name, int flags, char **error_msg) MONO_LLVM_INTERNAL;
33 char*       mono_dl_symbol     (MonoDl *module, const char *name, void **symbol) MONO_LLVM_INTERNAL;
34 void        mono_dl_close      (MonoDl *module) MONO_LLVM_INTERNAL;
35
36 char*       mono_dl_build_path (const char *directory, const char *name, void **iter);
37
38 MonoDl*     mono_dl_open_runtime_lib (const char *lib_name, int flags, char **error_msg);
39
40
41 //Platform API for mono_dl
42 const char* mono_dl_get_so_prefix (void);
43 const char** mono_dl_get_so_suffixes (void);
44 void* mono_dl_open_file (const char *file, int flags);
45 void mono_dl_close_handle (MonoDl *module);
46 void* mono_dl_lookup_symbol (MonoDl *module, const char *name);
47 int mono_dl_convert_flags (int flags);
48 char* mono_dl_current_error_string (void);
49 int mono_dl_get_executable_path (char *buf, int buflen);
50 const char* mono_dl_get_system_dir (void);
51
52 #endif /* __MONO_UTILS_DL_H__ */
53