OSDN Git Service

Add readme
[cinnamon-audio/cinnamon.git] / cin_export.h
1 /*
2  * Any copyright is dedicated to the Public Domain.
3  * http://creativecommons.org/publicdomain/zero/1.0/
4  */
5
6 #ifndef CIN_EXPORT_H
7 #define CIN_EXPORT_H
8 #pragma once
9
10 /*
11  * The build should have generated this file. It just contains a define for
12  * CIN_DLL on a DLL build, or nothing for a static build. If you are importing
13  * Cinnamon into another project, you can simply remove this include.
14  */
15 #include "cin_conf.inc"
16
17 #if ( defined _WIN32 ) && !( defined __GNUC__ )
18   
19   /* For a DLL build, use dllimport and dllexport. */
20   #ifdef CIN_DLL
21     
22     #ifdef CIN_INTERNAL
23       
24       /* TODO: Apparently __export is the right thing here with Watcom? */
25       #define CIN_DLL_EXPORT(X) __declspec(dllexport) X
26       
27     #else /* CIN_INTERNAL */
28       
29       #define CIN_DLL_EXPORT(X) __declspec(dllimport) X
30       
31     #endif /* CIN_INTERNAL */
32     
33   #else /* CIN_DLL */
34     
35     #define CIN_DLL_EXPORT(X) X
36     
37   #endif /* CIN_DLL */
38   
39   /* Use the C calling convention for all exported symbols. */
40   #define CIN_EXPORT(X) CIN_DLL_EXPORT(X) __cdecl
41   
42   /* We want to use fastcall for non-Watcom on internal functions. */
43   #ifdef __WATCOMC__
44     
45     #define CIN_PRIVATE(X) X
46     
47   #else
48   
49     #define CIN_PRIVATE(X) X __fastcall
50     
51   #endif
52   
53 #elif defined __GNUC__ /* GCC or not WIN32 */
54
55 #ifdef __CYGWIN__
56   /* Use the C calling convention for all exported symbols, with protected visibility. */
57   #define CIN_EXPORT(X) X __attribute__((visibility ("default"), cdecl, used))
58   /* Internal functions have hidden visibility. */
59   #define CIN_PRIVATE(X) X __attribute__((visibility("hidden"), fastcall))
60 #else
61   #define CIN_EXPORT(X) X __attribute__((visibility ("default")))
62   #define CIN_PRIVATE(X) X __attribute__((visibility("hidden")))
63 #endif
64     
65 #else /* not WIN32 and not GCC */
66     
67     #define CIN_EXPORT(X) X
68     #define CIN_PRIVATE(X) X
69     
70 #endif
71
72 #ifdef __GNUC__
73
74 #define CIN_PRIVATE_PURE(X) CIN_PRIVATE(X) __attribute__((const))
75
76 #elif defined _MSC_VER
77
78 #define CIN_PRIVATE_PURE(X) __declspec(noalias) CIN_PRIVATE(X)
79
80 #else
81
82 #define CIN_PRIVATE_PURE(X) CIN_PRIVATE(X)
83
84 #endif
85
86 #endif /* CIN_EXPORT_H */