summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgnacio Casal Quinteiro <icq@gnome.org>2015-10-27 13:22:55 +0100
committerIgnacio Casal Quinteiro <icq@gnome.org>2015-11-09 09:49:18 +0100
commite4572a770ecafc807296d9a2eb99e9dea0019887 (patch)
tree56f05cada1bb488b22a57f0c2c0d07cd0e1e57b4
parent903e5fd96635fbd05c2a66f29ea98583b6e30846 (diff)
downloadlibsoup-e4572a770ecafc807296d9a2eb99e9dea0019887.tar.gz
Declare a SOUP_VAR to externalize variables
This is needed to properly externalize the variables on windows. Since we need to handle dllexport vs dllimport https://bugzilla.gnome.org/show_bug.cgi?id=757146
-rw-r--r--libsoup/soup-method.h30
-rw-r--r--libsoup/soup-uri.h9
-rw-r--r--libsoup/soup-version.h.in19
3 files changed, 39 insertions, 19 deletions
diff --git a/libsoup/soup-method.h b/libsoup/soup-method.h
index 2934cca9..cec59e3c 100644
--- a/libsoup/soup-method.h
+++ b/libsoup/soup-method.h
@@ -58,22 +58,22 @@ G_BEGIN_DECLS
/* Do not use these variables directly; use the macros above, which
* ensure that they get initialized properly.
*/
-extern gpointer _SOUP_METHOD_OPTIONS;
-extern gpointer _SOUP_METHOD_GET;
-extern gpointer _SOUP_METHOD_HEAD;
-extern gpointer _SOUP_METHOD_POST;
-extern gpointer _SOUP_METHOD_PUT;
-extern gpointer _SOUP_METHOD_DELETE;
-extern gpointer _SOUP_METHOD_TRACE;
-extern gpointer _SOUP_METHOD_CONNECT;
+SOUP_VAR gpointer _SOUP_METHOD_OPTIONS;
+SOUP_VAR gpointer _SOUP_METHOD_GET;
+SOUP_VAR gpointer _SOUP_METHOD_HEAD;
+SOUP_VAR gpointer _SOUP_METHOD_POST;
+SOUP_VAR gpointer _SOUP_METHOD_PUT;
+SOUP_VAR gpointer _SOUP_METHOD_DELETE;
+SOUP_VAR gpointer _SOUP_METHOD_TRACE;
+SOUP_VAR gpointer _SOUP_METHOD_CONNECT;
-extern gpointer _SOUP_METHOD_PROPFIND;
-extern gpointer _SOUP_METHOD_PROPPATCH;
-extern gpointer _SOUP_METHOD_MKCOL;
-extern gpointer _SOUP_METHOD_COPY;
-extern gpointer _SOUP_METHOD_MOVE;
-extern gpointer _SOUP_METHOD_LOCK;
-extern gpointer _SOUP_METHOD_UNLOCK;
+SOUP_VAR gpointer _SOUP_METHOD_PROPFIND;
+SOUP_VAR gpointer _SOUP_METHOD_PROPPATCH;
+SOUP_VAR gpointer _SOUP_METHOD_MKCOL;
+SOUP_VAR gpointer _SOUP_METHOD_COPY;
+SOUP_VAR gpointer _SOUP_METHOD_MOVE;
+SOUP_VAR gpointer _SOUP_METHOD_LOCK;
+SOUP_VAR gpointer _SOUP_METHOD_UNLOCK;
G_END_DECLS
diff --git a/libsoup/soup-uri.h b/libsoup/soup-uri.h
index 35e670cd..1a81e978 100644
--- a/libsoup/soup-uri.h
+++ b/libsoup/soup-uri.h
@@ -39,10 +39,11 @@ GType soup_uri_get_type (void);
#define SOUP_URI_SCHEME_RESOURCE _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_RESOURCE, "resource")
#define SOUP_URI_SCHEME_WS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_WS, "ws")
#define SOUP_URI_SCHEME_WSS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_WSS, "wss")
-extern gpointer _SOUP_URI_SCHEME_HTTP, _SOUP_URI_SCHEME_HTTPS;
-extern gpointer _SOUP_URI_SCHEME_FTP;
-extern gpointer _SOUP_URI_SCHEME_FILE, _SOUP_URI_SCHEME_DATA, _SOUP_URI_SCHEME_RESOURCE;
-extern gpointer _SOUP_URI_SCHEME_WS, _SOUP_URI_SCHEME_WSS;
+
+SOUP_VAR gpointer _SOUP_URI_SCHEME_HTTP, _SOUP_URI_SCHEME_HTTPS;
+SOUP_VAR gpointer _SOUP_URI_SCHEME_FTP;
+SOUP_VAR gpointer _SOUP_URI_SCHEME_FILE, _SOUP_URI_SCHEME_DATA, _SOUP_URI_SCHEME_RESOURCE;
+SOUP_VAR gpointer _SOUP_URI_SCHEME_WS, _SOUP_URI_SCHEME_WSS;
SoupURI *soup_uri_new_with_base (SoupURI *base,
const char *uri_string);
diff --git a/libsoup/soup-version.h.in b/libsoup/soup-version.h.in
index 5c2c7a3b..f0775a8c 100644
--- a/libsoup/soup-version.h.in
+++ b/libsoup/soup-version.h.in
@@ -26,6 +26,25 @@ G_BEGIN_DECLS
#define _SOUP_EXTERN extern
#endif
+/* We prefix variable declarations so they can
+ * properly get exported in Windows DLLs.
+ */
+#ifndef SOUP_VAR
+# ifdef G_PLATFORM_WIN32
+# ifdef LIBSOUP_COMPILATION
+# ifdef DLL_EXPORT
+# define SOUP_VAR __declspec(dllexport)
+# else /* !DLL_EXPORT */
+# define SOUP_VAR extern
+# endif /* !DLL_EXPORT */
+# else /* !SOUP_COMPILATION */
+# define SOUP_VAR extern __declspec(dllimport)
+# endif /* !LIBSOUP_COMPILATION */
+# else /* !G_PLATFORM_WIN32 */
+# define SOUP_VAR _SOUP_EXTERN
+# endif /* !G_PLATFORM_WIN32 */
+#endif /* SOUP_VAR */
+
guint soup_get_major_version (void);
guint soup_get_minor_version (void);