Added MONO_API macro to annotate and control visibility of public (exported) APIs.
[mono.git] / mono / utils / mono-publib.h
1 #ifndef __MONO_PUBLIB_H__
2 #define __MONO_PUBLIB_H__
3
4 /* 
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.
8  */
9
10 #ifdef  __cplusplus
11 #define MONO_BEGIN_DECLS  extern "C" {
12 #define MONO_END_DECLS    }
13 #else
14 #define MONO_BEGIN_DECLS
15 #define MONO_END_DECLS
16 #endif
17
18 MONO_BEGIN_DECLS
19
20 /* VS 2010 and later have stdint.h */
21 #if defined(_MSC_VER)
22
23 #if _MSC_VER < 1600
24
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;
33
34 #else
35
36 #include <stdint.h>
37
38 #endif
39
40 #define MONO_API_EXPORT __declspec(dllexport)
41 #define MONO_API_IMPORT __declspec(dllimport)
42
43 #else
44
45 #define MONO_API_EXPORT
46 #define MONO_API_IMPORT
47
48 #endif /* end of compiler-specific stuff */
49
50 #if !defined(MONO_STATIC_BUILD) && defined(MONO_DLL_EXPORT)
51         #define MONO_API MONO_API_EXPORT
52 #elif !defined(MONO_STATIC_BUILD)
53         #define MONO_API MONO_API_IMPORT
54 #else
55         #define MONO_API
56 #endif
57
58 typedef int32_t         mono_bool;
59 typedef uint8_t         mono_byte;
60 typedef uint16_t        mono_unichar2;
61
62 typedef void    (*MonoFunc)     (void* data, void* user_data);
63 typedef void    (*MonoHFunc)    (void* key, void* value, void* user_data);
64
65 MONO_API void mono_free (void *);
66
67 #define MONO_CONST_RETURN const
68
69 MONO_END_DECLS
70
71 #endif /* __MONO_PUBLIB_H__ */
72