duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

rc_export.h (3052B)


      1 #ifndef RC_EXPORT_H
      2 #define RC_EXPORT_H
      3 
      4 /* These macros control how callbacks and public functions are defined */
      5 
      6 /* RC_SHARED should be defined when building rcheevos as a shared library (e.g. dll/dylib/so). External code should not define this macro. */
      7 /* RC_STATIC should be defined when building rcheevos as a static library. External code should also define this macro. */
      8 /* RC_IMPORT should be defined for external code using rcheevos as a shared library. */
      9 
     10 /* For compatibility, if none of these three macros are defined, then the build is assumed to be RC_STATIC */
     11 
     12 #if !defined(RC_SHARED) && !defined(RC_STATIC) && !defined(RC_IMPORT)
     13   #define RC_STATIC
     14 #endif
     15 
     16 #if (defined(RC_SHARED) && defined(RC_STATIC)) || (defined(RC_SHARED) && defined(RC_IMPORT)) || (defined(RC_STATIC) && defined(RC_IMPORT))
     17   #error RC_SHARED, RC_STATIC, and RC_IMPORT are mutually exclusive
     18 #endif
     19 
     20 /* RC_BEGIN_C_DECLS and RC_END_C_DECLS should be used for all headers, to enforce C linkage and the C calling convention */
     21 /* RC_BEGIN_C_DECLS should be placed after #include's and before header declarations */
     22 /* RC_END_C_DECLS should be placed after header declarations */
     23 
     24 /* example usage
     25  *
     26  * #ifndef RC_HEADER_H
     27  * #define RC_HEADER_H
     28  *
     29  * #include <stdint.h>
     30  *
     31  * RC_BEGIN_C_DECLS
     32  *
     33  * uint8_t rc_function(void);
     34  *
     35  * RC_END_C_DECLS
     36  *
     37  * #endif
     38  */
     39 
     40 #ifdef __cplusplus
     41   #define RC_BEGIN_C_DECLS extern "C" {
     42   #define RC_END_C_DECLS }
     43 #else
     44   #define RC_BEGIN_C_DECLS
     45   #define RC_END_C_DECLS
     46 #endif
     47 
     48 /* RC_CCONV should be used for public functions and callbacks, to enforce the cdecl calling convention, if applicable */
     49 /* RC_CCONV should be placed after the return type, and between the ( and * for callbacks */
     50 
     51 /* example usage */
     52 /* void RC_CCONV rc_function(void) */
     53 /* void (RC_CCONV *rc_callback)(void) */
     54 
     55 #if defined(_WIN32)
     56   /* Windows compilers will ignore __cdecl when not applicable */
     57   #define RC_CCONV __cdecl
     58 #elif defined(__GNUC__) && defined(__i386__)
     59   /* GNU C compilers will warn if cdecl is defined on an unsupported platform */
     60   #define RC_CCONV __attribute__((cdecl))
     61 #else
     62   #define RC_CCONV
     63 #endif
     64 
     65 /* RC_EXPORT should be used for public functions */
     66 /* RC_EXPORT will provide necessary hints for shared library usage, if applicable */
     67 /* RC_EXPORT should be placed before the return type */
     68 
     69 /* example usage */
     70 /* RC_EXPORT void rc_function(void) */
     71 
     72 #ifdef RC_SHARED
     73   #if defined(_WIN32)
     74     #define RC_EXPORT __declspec(dllexport)
     75   #elif defined(__GNUC__) && __GNUC__ >= 4
     76     #define RC_EXPORT __attribute__((visibility("default")))
     77   #else
     78     #define RC_EXPORT
     79   #endif
     80 #endif
     81 
     82 #ifdef RC_IMPORT
     83   #if defined(_WIN32)
     84     #define RC_EXPORT __declspec(dllimport)
     85   #elif defined(__GNUC__) && __GNUC__ >= 4
     86     #define RC_EXPORT __attribute__((visibility("default")))
     87   #else
     88     #define RC_EXPORT
     89   #endif
     90 #endif
     91 
     92 #ifdef RC_STATIC
     93   #if defined(__GNUC__) && __GNUC__ >= 4
     94     #define RC_EXPORT __attribute__((visibility("default")))
     95   #else
     96     #define RC_EXPORT
     97   #endif
     98 #endif
     99 
    100 #endif /* RC_EXPORT_H */