PLplot  5.15.0
pldll.h
Go to the documentation of this file.
1 #ifndef __PL_DLL_H
2 #define __PL_DLL_H
3 
4 // In some cases, this header is #included without #including
5 // plplot_config.h which normally #defines ENABLE_DYNDRIVERS (or not).
6 #ifndef ENABLE_DYNDRIVERS
7 // Define if there is support for dynamically loaded drivers
8 #define ENABLE_DYNDRIVERS
9 #endif
10 
11 
12 #ifdef USINGDLL
13  #if defined ( _WIN32 )
14 // Visual C/C++, Borland, MinGW and Watcom
15  #if defined ( __VISUALC__ ) || defined ( _MSC_VER ) || defined ( __BORLANDC__ ) || defined ( __GNUC__ ) || defined ( __WATCOMC__ )
16  #define PLDLLEXPORT __declspec( dllexport )
17  #define PLDLLIMPORT __declspec( dllimport )
18  #else
19  #define PLDLLEXPORT
20  #define PLDLLIMPORT
21  #endif
22  #elif defined ( __CYGWIN__ )
23  #define PLDLLEXPORT __declspec( dllexport )
24  #define PLDLLIMPORT __declspec( dllimport )
25  #elif defined ( __GNUC__ ) && __GNUC__ > 3
26 // Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x
27 // The following forces exported symbols specifically designated with
28 // PLDLLEXPORT to be visible.
29  #define PLDLLEXPORT __attribute__ ( ( visibility( "default" ) ) )
30  #define PLDLLIMPORT
31  #endif
32 #endif
33 
34 // For an unknown compiler or static built we clear the macros
35 #ifndef PLDLLEXPORT
36  #define PLDLLEXPORT
37  #define PLDLLIMPORT
38 #endif
39 
40 // The IMPEXP macros will always be set to DLLIMPORT (even for
41 // the static library, but DLLIMPORT is empty in this case), if
42 // cmake didn't set the corresponding macro xxxx_EXPORTS when the
43 // corresponding library is built (DLLIMPEXP is set to DLLEXPORT
44 // then)
45 #if defined ( plplot_EXPORTS )
46  #define PLDLLIMPEXP PLDLLEXPORT
47  #define PLDLLIMPEXP_DATA( type ) PLDLLEXPORT type
48 #else
49  #define PLDLLIMPEXP PLDLLIMPORT
50  #define PLDLLIMPEXP_DATA( type ) PLDLLIMPORT type
51 #endif
52 
53 // for dynamic drivers set the macros correctly. If a shared library is built,
54 // but dyanmic drivers disabled, the driver dll macros are the same as the
55 // plplot dll macros
56 #ifdef ENABLE_DYNDRIVERS
57  #if defined ( aqt_EXPORTS ) || \
58  defined ( cairo_EXPORTS ) || \
59  defined ( cgm_EXPORTS ) || \
60  defined ( gd_EXPORTS ) || \
61  defined ( mem_EXPORTS ) || \
62  defined ( ntk_EXPORTS ) || \
63  defined ( null_EXPORTS ) || \
64  defined ( pdf_EXPORTS ) || \
65  defined ( plmeta_EXPORTS ) || \
66  defined ( ps_EXPORTS ) || \
67  defined ( pstex_EXPORTS ) || \
68  defined ( psttf_EXPORTS ) || \
69  defined ( svg_EXPORTS ) || \
70  defined ( tk_EXPORTS ) || \
71  defined ( tkwin_EXPORTS ) || \
72  defined ( wingcc_EXPORTS ) || \
73  defined ( wxwidgets_EXPORTS ) || \
74  defined ( xfig_EXPORTS ) || \
75  defined ( xwin_EXPORTS ) || \
76  defined ( qt_EXPORTS ) || \
77  defined ( wingdi_EXPORTS )
78  #define PLDLLIMPEXP_DRIVER PLDLLEXPORT
79  #define PLDLLIMPEXP_DRIVER_DATA( type ) PLDLLEXPORT type
80  #else
81  #define PLDLLIMPEXP_DRIVER PLDLLIMPORT
82  #define PLDLLIMPEXP_DRIVER_DATA( type ) PLDLLIMPORT type
83  #endif
84 #else
85  #define PLDLLIMPEXP_DRIVER PLDLLIMPEXP
86  #define PLDLLIMPEXP_DRIVER_DATA( type ) PLDLLIMPEXP_DATA( type )
87 #endif
88 
89 #if defined ( plplotcxx_EXPORTS )
90  #define PLDLLIMPEXP_CXX PLDLLEXPORT
91  #define PLDLLIMPEXP_CXX_DATA( type ) PLDLLEXPORT type
92 #else
93  #define PLDLLIMPEXP_CXX PLDLLIMPORT
94  #define PLDLLIMPEXP_CXX_DATA( type ) PLDLLIMPORT type
95 #endif
96 
97 #if defined ( plplotfortranc_EXPORTS )
98  #define PLDLLIMPEXP_FORTRANC PLDLLEXPORT
99  #define PLDLLIMPEXP_FORTRANC_DATA( type ) PLDLLEXPORT type
100 #else
101  #define PLDLLIMPEXP_FORTRANC PLDLLIMPORT
102  #define PLDLLIMPEXP_FORTRANC_DATA( type ) PLDLLIMPORT type
103 #endif
104 
105 #if defined ( plplotwxwidgets_EXPORTS )
106  #define PLDLLIMPEXP_WX PLDLLEXPORT
107  #define PLDLLIMPEXP_WX_DATA( type ) PLDLLEXPORT type
108 #else
109  #define PLDLLIMPEXP_WX PLDLLIMPORT
110  #define PLDLLIMPEXP_WX_DATA( type ) PLDLLIMPORT type
111 #endif
112 
113 // Note for the case when ENABLE_DYNDRIVERS is not defined, the
114 // libplplot build specifically includes the tclmatrix code (see
115 // cmake/modules/tk.cmake).
116 #if defined ( tclmatrix_EXPORTS ) || \
117  ( !defined ( ENABLE_DYNDRIVERS ) && defined ( plplot_EXPORTS ) )
118  #define PLDLLIMPEXP_TCLMAT PLDLLEXPORT
119  #define PLDLLIMPEXP_TCLMAT_DATA( type ) PLDLLEXPORT type
120 #else
121  #define PLDLLIMPEXP_TCLMAT PLDLLIMPORT
122  #define PLDLLIMPEXP_TCLMAT_DATA( type ) PLDLLIMPORT type
123 #endif
124 
125 // Note for the case when ENABLE_DYNDRIVERS is not defined, the
126 // libplplot build specifically includes the plplottcltk code (see
127 // cmake/modules/tk.cmake).
128 #if defined ( plplottcltk_Main_EXPORTS ) || \
129  defined ( plplottcltk_EXPORTS ) || \
130  ( !defined ( ENABLE_DYNDRIVERS ) && defined ( plplot_EXPORTS ) )
131  #define PLDLLIMPEXP_TCLTK PLDLLEXPORT
132  #define PLDLLIMPEXP_TCLTK_DATA( type ) PLDLLEXPORT type
133 #else
134  #define PLDLLIMPEXP_TCLTK PLDLLIMPORT
135  #define PLDLLIMPEXP_TCLTK_DATA( type ) PLDLLIMPORT type
136 #endif
137 
138 // Note for the case when ENABLE_DYNDRIVERS is not defined, the
139 // libplplot build specifically includes bindings/qt-gui/plqt.cpp (see
140 // cmake/modules/qt.cmake).
141 #if defined ( plplotqt_EXPORTS ) || \
142  ( !defined ( ENABLE_DYNDRIVERS ) && defined ( plplot_EXPORTS ) )
143  #define PLDLLIMPEXP_QT PLDLLEXPORT
144  #define PLDLLIMPEXP_QT_DATA( type ) PLDLLEXPORT type
145 #else
146  #define PLDLLIMPEXP_QT PLDLLIMPORT
147  #define PLDLLIMPEXP_QT_DATA( type ) PLDLLIMPORT type
148 #endif
149 
150 #if defined ( plplot_pyqt4_EXPORTS )
151  #define PLDLLIMPEXP_PYQT4 PLDLLEXPORT
152  #define PLDLLIMPEXP_PYQT4_DATA( type ) PLDLLEXPORT type
153 #else
154  #define PLDLLIMPEXP_PYQT4 PLDLLIMPORT
155  #define PLDLLIMPEXP_PYQT4_DATA( type ) PLDLLIMPORT type
156 #endif
157 
158 #if defined ( plplot_pyqt5_EXPORTS )
159  #define PLDLLIMPEXP_PYQT5 PLDLLEXPORT
160  #define PLDLLIMPEXP_PYQT5_DATA( type ) PLDLLEXPORT type
161 #else
162  #define PLDLLIMPEXP_PYQT5 PLDLLIMPORT
163  #define PLDLLIMPEXP_PYQT5_DATA( type ) PLDLLIMPORT type
164 #endif
165 
166 #endif // __PL_DLL_H