summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthieu Darbois <mayeut@users.noreply.github.com>2015-01-25 16:59:39 +0000
committerMatthieu Darbois <mayeut@users.noreply.github.com>2015-01-25 16:59:39 +0000
commit3ed5858902055d3500a6ab183f1395686921d026 (patch)
tree04d76f3de59f9f4a815e2111edf5a1c13e68aec3 /src
parent7a8cdc4bb071494fccf4714413191a52eb924b60 (diff)
[trunk] use hidden visibility for static library (fixes issue 354)
Diffstat (limited to 'src')
-rw-r--r--src/lib/openjp2/openjpeg.h32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h
index 988db720..4a8e75ce 100644
--- a/src/lib/openjp2/openjpeg.h
+++ b/src/lib/openjp2/openjpeg.h
@@ -78,16 +78,20 @@ Most compilers implement their own version of this keyword ...
#if defined(OPJ_STATIC) || !defined(_WIN32)
/* http://gcc.gnu.org/wiki/Visibility */
-#if __GNUC__ >= 4
-#define OPJ_API __attribute__ ((visibility ("default")))
-#define OPJ_LOCAL __attribute__ ((visibility ("hidden")))
+# if __GNUC__ >= 4
+# if defined(OPJ_STATIC) /* static library uses "hidden" */
+# define OPJ_API __attribute__ ((visibility ("hidden")))
+# else
+# define OPJ_API __attribute__ ((visibility ("default")))
+# endif
+# define OPJ_LOCAL __attribute__ ((visibility ("hidden")))
+# else
+# define OPJ_API
+# define OPJ_LOCAL
+# endif
+# define OPJ_CALLCONV
#else
-#define OPJ_API
-#define OPJ_LOCAL
-#endif
-#define OPJ_CALLCONV
-#else
-#define OPJ_CALLCONV __stdcall
+# define OPJ_CALLCONV __stdcall
/*
The following ifdef block is the standard way of creating macros which make exporting
from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS
@@ -96,11 +100,11 @@ that uses this DLL. This way any other project whose source files include this f
OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols
defined with this macro as being exported.
*/
-#if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
-#define OPJ_API __declspec(dllexport)
-#else
-#define OPJ_API __declspec(dllimport)
-#endif /* OPJ_EXPORTS */
+# if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
+# define OPJ_API __declspec(dllexport)
+# else
+# define OPJ_API __declspec(dllimport)
+# endif /* OPJ_EXPORTS */
#endif /* !OPJ_STATIC || !_WIN32 */
typedef int OPJ_BOOL;