Add missing 'extern' to the dllexport version of GLIB_VAR/GOBJECT_VAR

The __declspec(dllexport) attribute in itself doesn't imply
'extern' - thus any intended variable declaration with
GLIB_VAR/GOBJECT_VAR would actually be a variable definition. With
C compilers defaulting to -fcommon, this isn't an issue, but
upcoming compilers (GCC 10 and Clang 11) will default to -fno-common,
ending up with duplicate definitions of these variables.
This commit is contained in:
Martin Storsjö 2020-03-31 23:15:23 +03:00
parent 50355361e6
commit fdfadfc276
2 changed files with 2 additions and 2 deletions

View File

@ -565,7 +565,7 @@ G_END_DECLS
# else /* !GLIB_STATIC_COMPILATION */
# ifdef GLIB_COMPILATION
# ifdef DLL_EXPORT
# define GLIB_VAR __declspec(dllexport)
# define GLIB_VAR extern __declspec(dllexport)
# else /* !DLL_EXPORT */
# define GLIB_VAR extern
# endif /* !DLL_EXPORT */

View File

@ -1150,7 +1150,7 @@ GParamSpec* g_param_spec_variant (const gchar *name,
# else /* !GOBJECT_STATIC_COMPILATION */
# ifdef GOBJECT_COMPILATION
# ifdef DLL_EXPORT
# define GOBJECT_VAR __declspec(dllexport)
# define GOBJECT_VAR extern __declspec(dllexport)
# else /* !DLL_EXPORT */
# define GOBJECT_VAR extern
# endif /* !DLL_EXPORT */