Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From fdfadfc27604b58886d7a33cf5f78bb0617733e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Tue, 31 Mar 2020 23:15:23 +0300
Subject: [PATCH] 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.
---
glib/gtypes.h | 2 +-
gobject/gparamspecs.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/glib/gtypes.h b/glib/gtypes.h
index df65836a0..23c5a1295 100644
--- a/glib/gtypes.h
+++ b/glib/gtypes.h
@@ -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 */
diff --git a/gobject/gparamspecs.h b/gobject/gparamspecs.h
index 0309f9bb3..d0e4d5953 100644
--- a/gobject/gparamspecs.h
+++ b/gobject/gparamspecs.h
@@ -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 */
--
2.25.1