summaryrefslogtreecommitdiff
path: root/ws_symbol_export.h
diff options
context:
space:
mode:
authorBalint Reczey <balint@balintreczey.hu>2013-02-28 14:09:46 +0000
committerBalint Reczey <balint@balintreczey.hu>2013-02-28 14:09:46 +0000
commit45c2884f1bbd9c06f7ba3091d968fcb6649a5f56 (patch)
treebb66eea36a288f1ab5e33468ee9bf2989339b2aa /ws_symbol_export.h
parent018ba4ea6584f63aa5c4b741c2e6f6fedc609ad2 (diff)
downloadwireshark-45c2884f1bbd9c06f7ba3091d968fcb6649a5f56.tar.gz
Export libwsutil symbols using WS_DLL_PUBLIC define
This change replaces *.def and *.sym file usage following the guideline at http://gcc.gnu.org/wiki/Visibility svn path=/trunk/; revision=47938
Diffstat (limited to 'ws_symbol_export.h')
-rw-r--r--ws_symbol_export.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/ws_symbol_export.h b/ws_symbol_export.h
new file mode 100644
index 0000000000..599ac2e64a
--- /dev/null
+++ b/ws_symbol_export.h
@@ -0,0 +1,54 @@
+/*
+ * Cross platform defines for exporting symbols from shared libraries
+ *
+ * Wireshark - Network traffic analyzer
+ * By Balint Reczey <balint@balintreczey.hu>
+ * Copyright 2013 Balint Reczey
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef SYMBOL_EXPORT_H
+#define SYMBOL_EXPORT_H
+
+/* Originally copied from GCC Wiki at http://gcc.gnu.org/wiki/Visibility */
+#if defined _WIN32 || defined __CYGWIN__
+ #ifdef WS_BUILD_DLL
+ #ifdef __GNUC__
+#define WS_DLL_PUBLIC __attribute__ ((dllexport))
+ #else /* ! __GNUC__ */
+#define WS_DLL_PUBLIC __declspec(dllexport) // Note: actually gcc seems to also support this syntax.
+ #endif /* __GNUC__ */
+ #else
+ #ifdef __GNUC__
+#define WS_DLL_PUBLIC __attribute__ ((dllimport))
+ #elif ! (defined ENABLE_STATIC) /* ! __GNUC__ */
+#define WS_DLL_PUBLIC __declspec(dllimport) // Note: actually gcc seems to also support this syntax.
+ #else /* ! __GNUC__ && ENABLE_STATIC */
+#define WS_DLL_PUBLIC
+ #endif /* __GNUC__ */
+ #endif /* WS_BUILD_DLL */
+ #define WS_DLL_LOCAL
+#else
+ #if __GNUC__ >= 4
+#define WS_DLL_PUBLIC __attribute__ ((visibility ("default")))
+#define WS_DLL_LOCAL __attribute__ ((visibility ("hidden")))
+ #else /* ! __GNUC__ >= 4 */
+ #define WS_DLL_PUBLIC
+ #define WS_DLL_LOCAL
+ #endif /* __GNUC__ >= 4 */
+#endif
+
+#endif /* SYMBOL_EXPORT_H */