aboutsummaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/nanomsg/nn.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/compat/nanomsg/nn.h b/src/compat/nanomsg/nn.h
index 789aed3e..63431728 100644
--- a/src/compat/nanomsg/nn.h
+++ b/src/compat/nanomsg/nn.h
@@ -44,10 +44,9 @@ extern "C" {
// clang-format off
// NNG_DECL is used on declarations to deal with scope.
-// For building Windows DLLs, it should be the appropriate
-// __declspec(). (We recommend *not* building this library
-// as a DLL, but instead linking it statically for your projects
-// to minimize questions about link dependencies later.)
+// For building Windows DLLs, it should be the appropriate __declspec().
+// For shared libraries with platforms that support hidden visibility,
+// it should evaluate to __attribute__((visibility("default"))).
#ifndef NN_DECL
#if defined(_WIN32) && !defined(NNG_STATIC_LIB)
#if defined(NNG_SHARED_LIB)
@@ -56,8 +55,12 @@ extern "C" {
#define NN_DECL __declspec(dllimport)
#endif // NNG_SHARED_LIB
#else
-#define NN_DECL extern
-#endif // _WIN32 && !NNG_STATIC_LIB
+#if defined(NNG_SHARED_LIB) && defined(NNG_HIDDEN_VISIBILITY)
+#define NN_DECL __attribute__((visibility("default")))
+#else
+#define NN_DECL extern
+#endif
+#endif // _WIN32 && !NNG_STATIC_LIB
#endif // NN_DECL
#define AF_SP 1