5 #ifndef __MONO_PUBLIB_H__
6 #define __MONO_PUBLIB_H__
9 * Minimal general purpose header for use in public mono header files.
10 * We can't include config.h, so we use compiler-specific preprocessor
11 * directives where needed.
15 #define MONO_BEGIN_DECLS extern "C" {
16 #define MONO_END_DECLS }
18 #define MONO_BEGIN_DECLS
19 #define MONO_END_DECLS
24 /* VS 2010 and later have stdint.h */
29 typedef __int8 int8_t;
30 typedef unsigned __int8 uint8_t;
31 typedef __int16 int16_t;
32 typedef unsigned __int16 uint16_t;
33 typedef __int32 int32_t;
34 typedef unsigned __int32 uint32_t;
35 typedef __int64 int64_t;
36 typedef unsigned __int64 uint64_t;
44 #define MONO_API_EXPORT __declspec(dllexport)
45 #define MONO_API_IMPORT __declspec(dllimport)
52 #define MONO_API_EXPORT __attribute__ ((__visibility__ ("default")))
54 #define MONO_API_EXPORT
56 #define MONO_API_IMPORT
58 #endif /* end of compiler-specific stuff */
62 #if defined(MONO_DLL_EXPORT)
63 #define MONO_API MONO_API_EXPORT
64 #elif defined(MONO_DLL_IMPORT)
65 #define MONO_API MONO_API_IMPORT
70 typedef int32_t mono_bool;
71 typedef uint8_t mono_byte;
72 typedef uint16_t mono_unichar2;
73 typedef uint32_t mono_unichar4;
75 typedef void (*MonoFunc) (void* data, void* user_data);
76 typedef void (*MonoHFunc) (void* key, void* value, void* user_data);
78 MONO_API void mono_free (void *);
80 #define MONO_ALLOCATOR_VTABLE_VERSION 1
84 void *(*malloc) (size_t size);
85 void *(*realloc) (void *mem, size_t count);
86 void (*free) (void *mem);
87 void *(*calloc) (size_t count, size_t size);
88 } MonoAllocatorVTable;
91 mono_set_allocator_vtable (MonoAllocatorVTable* vtable);
94 #define MONO_CONST_RETURN const
97 * When embedding, you have to define MONO_ZERO_LEN_ARRAY before including any
98 * other Mono header file if you use a different compiler from the one used to
101 #ifndef MONO_ZERO_LEN_ARRAY
103 #define MONO_ZERO_LEN_ARRAY 0
105 #define MONO_ZERO_LEN_ARRAY 1
109 #if defined (MONO_INSIDE_RUNTIME)
111 #if defined (__clang__)
112 #define MONO_RT_EXTERNAL_ONLY __attribute__ ((__unavailable__ ("The mono runtime must not call this function")))
113 #elif defined (__GNUC__)
114 #define MONO_RT_EXTERNAL_ONLY __attribute__ ((__error__ ("The mono runtime must not call this function")))
116 #define MONO_RT_EXTERNAL_ONLY
117 #endif /* __clang__ */
120 #define MONO_RT_EXTERNAL_ONLY
121 #endif /* MONO_INSIDE_RUNTIME */
124 #define _MONO_DEPRECATED __attribute__ ((__deprecated__))
125 #elif defined (_MSC_VER)
126 #define _MONO_DEPRECATED __declspec (deprecated)
128 #define _MONO_DEPRECATED
131 #define MONO_DEPRECATED MONO_API MONO_RT_EXTERNAL_ONLY _MONO_DEPRECATED
135 #endif /* __MONO_PUBLIB_H__ */