Fix warning: C++ style comments are not allowed in ISO C90 [enabled by default]
[metze/wireshark/wip.git] / ws_symbol_export.h
1 /*
2  * Cross platform defines for exporting symbols from shared libraries
3  *
4  * Wireshark - Network traffic analyzer
5  * By Balint Reczey <balint@balintreczey.hu>
6  * Copyright 2013 Balint Reczey
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef SYMBOL_EXPORT_H
24 #define SYMBOL_EXPORT_H
25
26 /* Originally copied from GCC Wiki at http://gcc.gnu.org/wiki/Visibility */
27 #if defined _WIN32 || defined __CYGWIN__
28   #ifdef WS_BUILD_DLL
29     #ifdef __GNUC__
30 #define WS_DLL_PUBLIC __attribute__ ((dllexport))
31     #else /* ! __GNUC__ */
32 #define WS_DLL_PUBLIC __declspec(dllexport) /* Note: actually gcc seems to also support this syntax. */
33     #endif /* __GNUC__ */
34   #else
35     #ifdef __GNUC__
36 #define WS_DLL_PUBLIC __attribute__ ((dllimport))
37     #elif ! (defined ENABLE_STATIC) /* ! __GNUC__ */
38 #define WS_DLL_PUBLIC __declspec(dllimport) /* Note: actually gcc seems to also support this syntax. */
39     #else /* ! __GNUC__  && ENABLE_STATIC */
40 #define WS_DLL_PUBLIC
41     #endif /* __GNUC__ */
42   #endif /* WS_BUILD_DLL */
43   #define WS_DLL_LOCAL
44 #else
45   #if __GNUC__ >= 4
46 #define WS_DLL_PUBLIC __attribute__ ((visibility ("default")))
47 #define WS_DLL_LOCAL  __attribute__ ((visibility ("hidden")))
48   #else /* ! __GNUC__ >= 4 */
49     #define WS_DLL_PUBLIC
50     #define WS_DLL_LOCAL
51   #endif /* __GNUC__ >= 4 */
52 #endif
53
54 #endif /* SYMBOL_EXPORT_H */