X-Git-Url: http://git.samba.org/?a=blobdiff_plain;f=ws_symbol_export.h;h=45082d3256b3a1cf10c47afdbe62f4b4e3db1252;hb=1b0a6ff5ab3c84f3822eecab0c72668b88ce7cd9;hp=ebf9e7d935f93922c2e0e65a87916bccc30d28e0;hpb=dd1034e1f5f2285721a9deb8b95ea17222e50939;p=metze%2Fwireshark%2Fwip.git diff --git a/ws_symbol_export.h b/ws_symbol_export.h index ebf9e7d935..45082d3256 100644 --- a/ws_symbol_export.h +++ b/ws_symbol_export.h @@ -1,8 +1,6 @@ /* * Cross platform defines for exporting symbols from shared libraries * - * $Id$ - * * Wireshark - Network traffic analyzer * By Balint Reczey * Copyright 2013 Balint Reczey @@ -49,6 +47,29 @@ #ifndef SYMBOL_EXPORT_H #define SYMBOL_EXPORT_H +/* + * NOTE: G_HAVE_GNUC_VISIBILITY is defined only if all of + * + * __attribute__ ((visibility ("hidden"))) + * + * __attribute__ ((visibility ("internal"))) + * + * __attribute__ ((visibility ("protected"))) + * + * __attribute__ ((visibility ("default"))) + * + * are supported, and at least some versions of GCC from Apple support + * "default" and "hidden" but not "internal" or "protected", so it + * shouldn't be used to determine whether "hidden" or "default" is + * supported. + * + * This also means that we shouldn't use G_GNUC_INTERNAL instead of + * WS_DLL_LOCAL, as GLib uses G_HAVE_GNUC_VISIBILITY to determine + * whether to use __attribute__ ((visibility ("hidden"))) for + * G_GNUC_INTERNAL, and that will not use it even with compilers + * that support it. + */ + /* Originally copied from GCC Wiki at http://gcc.gnu.org/wiki/Visibility */ #if defined _WIN32 || defined __CYGWIN__ /* Compiling for Windows, so we use the Windows DLL declarations. */ @@ -123,10 +144,26 @@ #define WS_DLL_LOCAL __attribute__ ((visibility ("hidden"))) #else /* ! __GNUC__ >= 4 */ /* - * We have no way to control visibility. + * We have no way to make stuff not explicitly marked as + * visible invisible outside a library, but we might have + * a way to make stuff explicitly marked as local invisible + * outside the library. + * + * This was lifted from GLib; see above for why we don't use + * G_GNUC_INTERNAL. */ - #define WS_DLL_PUBLIC_DEF - #define WS_DLL_LOCAL + #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) + /* This supports GCC-style __attribute__ ((visibility (XXX))) */ + #define WS_DLL_PUBLIC_DEF __attribute__ ((visibility ("default"))) + #define WS_DLL_LOCAL __attribute__ ((visibility ("hidden"))) + #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) + /* This doesn't, but supports __global and __hidden */ + #define WS_DLL_PUBLIC_DEF __global + #define WS_DLL_LOCAL __hidden + #else /* not Sun C with "hidden" support */ + #define WS_DLL_PUBLIC_DEF + #define WS_DLL_LOCAL + #endif #endif /* __GNUC__ >= 4 */ #endif @@ -141,6 +178,19 @@ * * Either can be used for exported *function* declarations and definitions. */ -#define WS_DLL_PUBLIC WS_DLL_PUBLIC_DEF extern +#define WS_DLL_PUBLIC WS_DLL_PUBLIC_DEF extern #endif /* SYMBOL_EXPORT_H */ + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */