summaryrefslogtreecommitdiff
path: root/visibility.h
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-10-06 11:25:02 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2022-10-06 12:34:03 -0400
commit2ba1cdd916e2e3d64c3065f55fe26c8438c20424 (patch)
treee04dff2eb38503e710a4956d2a8b8b109d280c9f /visibility.h
parent75a24d05d344e1a1d94618020422fa868e81300f (diff)
downloadglib-networking-2ba1cdd916e2e3d64c3065f55fe26c8438c20424.tar.gz
Fix static link on Windows
When making a static module on Windows, we should not have `dllexport` on g_io_* functions. However, G_MODULE_EXPORT is defined to always have `dllexport` on Windows because it is made for shared modules only. Building both shared and static modules is not supported on Windows. Part-of: <https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/223>
Diffstat (limited to 'visibility.h')
-rw-r--r--visibility.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/visibility.h b/visibility.h
new file mode 100644
index 0000000..9f7c1d5
--- /dev/null
+++ b/visibility.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(GLIB_NETWORKING_STATIC_COMPILATION)
+# define GLIB_NETWORKING_EXPORT __declspec(dllexport)
+#elif __GNUC__ >= 4
+# define GLIB_NETWORKING_EXPORT __attribute__((visibility("default")))
+#else
+# define GLIB_NETWORKING_EXPORT
+#endif