X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fmono-publib.h;h=df810a98e1ae1c8fccf1e93d7168713b2fc04f5c;hb=6474f8e6126933773a64374c6a38d662bf80d150;hp=a418cadeca17dba4b1dd5de93e06c03fbcf3da77;hpb=6733010353a6024a2b437a6cd5c5c30ae6e99218;p=mono.git diff --git a/mono/utils/mono-publib.h b/mono/utils/mono-publib.h index a418cadeca1..df810a98e1a 100644 --- a/mono/utils/mono-publib.h +++ b/mono/utils/mono-publib.h @@ -44,11 +44,17 @@ typedef unsigned __int64 uint64_t; #include +#ifdef __GNUC__ +#define MONO_API_EXPORT __attribute__ ((visibility ("default"))) +#else #define MONO_API_EXPORT +#endif #define MONO_API_IMPORT #endif /* end of compiler-specific stuff */ +#include + #if defined(MONO_DLL_EXPORT) #define MONO_API MONO_API_EXPORT #elif defined(MONO_DLL_IMPORT) @@ -65,10 +71,51 @@ typedef uint32_t mono_unichar4; typedef void (*MonoFunc) (void* data, void* user_data); typedef void (*MonoHFunc) (void* key, void* value, void* user_data); +typedef struct { + void* (*malloc) (size_t n_bytes); + void* (*realloc) (void* mem, size_t n_bytes); + void (*free) (void* mem); + void* (*calloc) (size_t n_blocks, size_t n_block_bytes); +} MonoAllocatorVTable; + +/* + * eglib must be built with overridable allocator support (G_OVERRIDABLE_ALLOCATORS=1) + * for mono_set_allocator_vtable to do anything. + */ +MONO_API void mono_set_allocator_vtable (MonoAllocatorVTable* vtable); + 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__ */