1 #ifndef __MONO_PUBLIB_H__
2 #define __MONO_PUBLIB_H__
5 * Minimal general purpose header for use in public mono header files.
6 * We can't include config.h, so we use compiler-specific preprocessor
7 * directives where needed.
11 #define MONO_BEGIN_DECLS extern "C" {
12 #define MONO_END_DECLS }
14 #define MONO_BEGIN_DECLS
15 #define MONO_END_DECLS
20 /* VS 2010 and later have stdint.h */
25 typedef __int8 int8_t;
26 typedef unsigned __int8 uint8_t;
27 typedef __int16 int16_t;
28 typedef unsigned __int16 uint16_t;
29 typedef __int32 int32_t;
30 typedef unsigned __int32 uint32_t;
31 typedef __int64 int64_t;
32 typedef unsigned __int64 uint64_t;
40 #define MONO_API_EXPORT __declspec(dllexport)
41 #define MONO_API_IMPORT __declspec(dllimport)
48 #define MONO_API_EXPORT __attribute__ ((visibility ("default")))
50 #define MONO_API_EXPORT
52 #define MONO_API_IMPORT
54 #endif /* end of compiler-specific stuff */
58 #if defined(MONO_DLL_EXPORT)
59 #define MONO_API MONO_API_EXPORT
60 #elif defined(MONO_DLL_IMPORT)
61 #define MONO_API MONO_API_IMPORT
66 typedef int32_t mono_bool;
67 typedef uint8_t mono_byte;
68 typedef uint16_t mono_unichar2;
69 typedef uint32_t mono_unichar4;
71 typedef void (*MonoFunc) (void* data, void* user_data);
72 typedef void (*MonoHFunc) (void* key, void* value, void* user_data);
75 void* (*malloc) (size_t n_bytes);
76 void* (*realloc) (void* mem, size_t n_bytes);
77 void (*free) (void* mem);
78 void* (*calloc) (size_t n_blocks, size_t n_block_bytes);
79 } MonoAllocatorVTable;
82 * eglib must be built with overridable allocator support (G_OVERRIDABLE_ALLOCATORS=1)
83 * for mono_set_allocator_vtable to do anything.
85 MONO_API void mono_set_allocator_vtable (MonoAllocatorVTable* vtable);
87 MONO_API void mono_free (void *);
89 #define MONO_CONST_RETURN const
92 * When embedding, you have to define MONO_ZERO_LEN_ARRAY before including any
93 * other Mono header file if you use a different compiler from the one used to
96 #ifndef MONO_ZERO_LEN_ARRAY
98 #define MONO_ZERO_LEN_ARRAY 0
100 #define MONO_ZERO_LEN_ARRAY 1
104 #if defined (MONO_INSIDE_RUNTIME)
106 #if defined (__clang__)
107 #define MONO_RT_EXTERNAL_ONLY __attribute__ ((unavailable("The mono runtime must not call this function")))
108 #elif defined (__GNUC__)
109 #define MONO_RT_EXTERNAL_ONLY __attribute__ ((error("The mono runtime must not call this function")))
111 #define MONO_RT_EXTERNAL_ONLY
112 #endif /* __clang__ */
115 #define MONO_RT_EXTERNAL_ONLY
116 #endif /* MONO_INSIDE_RUNTIME */
121 #endif /* __MONO_PUBLIB_H__ */