File: rc_export.h

package info (click to toggle)
rcheevos 12.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,372 kB
  • sloc: ansic: 57,087; makefile: 300
file content (100 lines) | stat: -rw-r--r-- 3,081 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef RC_EXPORT_H
#define RC_EXPORT_H

/* These macros control how callbacks and public functions are defined */

/* RC_SHARED should be defined when building rcheevos as a shared library (e.g. dll/dylib/so). External code should not define this macro. */
/* RC_STATIC should be defined when building rcheevos as a static library. External code should also define this macro. */
/* RC_IMPORT should be defined for external code using rcheevos as a shared library. */

/* For compatibility, if none of these three macros are defined, then the build is assumed to be RC_STATIC */

#if !defined(RC_SHARED) && !defined(RC_STATIC) && !defined(RC_IMPORT)
  #define RC_STATIC
#endif

#if (defined(RC_SHARED) && defined(RC_STATIC)) || (defined(RC_SHARED) && defined(RC_IMPORT)) || (defined(RC_STATIC) && defined(RC_IMPORT))
  #error RC_SHARED, RC_STATIC, and RC_IMPORT are mutually exclusive
#endif

/* RC_BEGIN_C_DECLS and RC_END_C_DECLS should be used for all headers, to enforce C linkage and the C calling convention */
/* RC_BEGIN_C_DECLS should be placed after #include's and before header declarations */
/* RC_END_C_DECLS should be placed after header declarations */

/* example usage
 *
 * #ifndef RC_HEADER_H
 * #define RC_HEADER_H
 *
 * #include <stdint.h>
 *
 * RC_BEGIN_C_DECLS
 *
 * uint8_t rc_function(void);
 *
 * RC_END_C_DECLS
 *
 * #endif
 */

#if defined(__cplusplus) && !defined(CXX_BUILD)
  #define RC_BEGIN_C_DECLS extern "C" {
  #define RC_END_C_DECLS }
#else
  #define RC_BEGIN_C_DECLS
  #define RC_END_C_DECLS
#endif

/* RC_CCONV should be used for public functions and callbacks, to enforce the cdecl calling convention, if applicable */
/* RC_CCONV should be placed after the return type, and between the ( and * for callbacks */

/* example usage */
/* void RC_CCONV rc_function(void) */
/* void (RC_CCONV *rc_callback)(void) */

#if defined(_WIN32)
  /* Windows compilers will ignore __cdecl when not applicable */
  #define RC_CCONV __cdecl
#elif defined(__GNUC__) && defined(__i386__)
  /* GNU C compilers will warn if cdecl is defined on an unsupported platform */
  #define RC_CCONV __attribute__((cdecl))
#else
  #define RC_CCONV
#endif

/* RC_EXPORT should be used for public functions */
/* RC_EXPORT will provide necessary hints for shared library usage, if applicable */
/* RC_EXPORT should be placed before the return type */

/* example usage */
/* RC_EXPORT void rc_function(void) */

#ifdef RC_SHARED
  #if defined(_WIN32)
    #define RC_EXPORT __declspec(dllexport)
  #elif defined(__GNUC__) && __GNUC__ >= 4
    #define RC_EXPORT __attribute__((visibility("default")))
  #else
    #define RC_EXPORT
  #endif
#endif

#ifdef RC_IMPORT
  #if defined(_WIN32)
    #define RC_EXPORT __declspec(dllimport)
  #elif defined(__GNUC__) && __GNUC__ >= 4
    #define RC_EXPORT __attribute__((visibility("default")))
  #else
    #define RC_EXPORT
  #endif
#endif

#ifdef RC_STATIC
  #if defined(__GNUC__) && __GNUC__ >= 4
    #define RC_EXPORT __attribute__((visibility("default")))
  #else
    #define RC_EXPORT
  #endif
#endif

#endif /* RC_EXPORT_H */