Merge pull request #2979 from akoeplinger/tests-simplify
[mono.git] / mono / utils / mono-publib.h
index c9becb2bf5e24f5e99c4b2e9d54d6284511dbf8a..53d4aa3ea7f4bed28874b023c70f33b9fd9cd490 100644 (file)
@@ -73,6 +73,34 @@ MONO_API void mono_free (void *);
 
 #define MONO_CONST_RETURN const
 
+/*
+ * When embedding, you have to define MONO_ZERO_LEN_ARRAY before including any
+ * other Mono header file if you use a different compiler from the one used to
+ * build Mono.
+ */
+#ifndef MONO_ZERO_LEN_ARRAY
+#ifdef __GNUC__
+#define MONO_ZERO_LEN_ARRAY 0
+#else
+#define MONO_ZERO_LEN_ARRAY 1
+#endif
+#endif
+
+#if defined (MONO_INSIDE_RUNTIME)
+
+#if defined (__clang__)
+#define MONO_RT_EXTERNAL_ONLY __attribute__ ((unavailable("The mono runtime must not call this function")))
+#elif defined (__GNUC__)
+#define MONO_RT_EXTERNAL_ONLY __attribute__ ((error("The mono runtime must not call this function")))
+#else
+#define MONO_RT_EXTERNAL_ONLY
+#endif /* __clang__ */
+
+#else
+#define MONO_RT_EXTERNAL_ONLY
+#endif /* MONO_INSIDE_RUNTIME */
+
+
 MONO_END_DECLS
 
 #endif /* __MONO_PUBLIB_H__ */