mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-29 02:26:34 +02:00
gmodule: Add the visibility attribute to G_MODULE_EXPORT on gcc
For versions of GCC which support it (≥ 4), define G_MODULE_EXPORT as __attribute__((visibility("default"))). This is normally a no-op, unless compiling with -fvisibility=hidden, in which case it marks a symbol to be publicly exported from the library, which is what G_MODULE_EXPORT is for. Previously G_MODULE_EXPORT has only worked on Windows. The compatibility check for whether the compiler supports __attribute__((visibility)) is based on the __GNUC__ define, and is similar to the check done in configure.ac for defining G_GNUC_INTERNAL. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=778287
This commit is contained in:
committed by
Matthias Clasen
parent
261de46cca
commit
f46cbf6b08
@@ -35,7 +35,9 @@ G_BEGIN_DECLS
|
||||
#define G_MODULE_IMPORT extern
|
||||
#ifdef G_PLATFORM_WIN32
|
||||
# define G_MODULE_EXPORT __declspec(dllexport)
|
||||
#else /* !G_PLATFORM_WIN32 */
|
||||
#elif __GNUC__ >= 4
|
||||
# define G_MODULE_EXPORT __attribute__((visibility("default")))
|
||||
#else /* !G_PLATFORM_WIN32 && __GNUC__ < 4 */
|
||||
# define G_MODULE_EXPORT
|
||||
#endif /* !G_PLATFORM_WIN32 */
|
||||
|
||||
|
Reference in New Issue
Block a user