summaryrefslogtreecommitdiffstats
path: root/lib/lz4frame.h
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2017-03-10 23:35:30 (GMT)
committerDmitry V. Levin <ldv@altlinux.org>2017-03-10 23:35:30 (GMT)
commit7aeecbff7178d72da1786ed30817fe8071c4d9ea (patch)
tree53d209287c8cd547b4f78162cd84b986ea95dcb3 /lib/lz4frame.h
parent93b3b08ef62567be3585a3cd6fc1147ed0ff7045 (diff)
downloadlz4-7aeecbff7178d72da1786ed30817fe8071c4d9ea.zip
lz4-7aeecbff7178d72da1786ed30817fe8071c4d9ea.tar.gz
lz4-7aeecbff7178d72da1786ed30817fe8071c4d9ea.tar.bz2
Explicitly set visibility of public API functions when gcc is used
Windows builds already limit exporting of functions to those marked with LZ4LIB_API tag. The same behaviour could be achieved on other platforms when a relatively fresh gcc is used. This change assigns public visibility to all symbols marked with LZ4LIB_API tag. When the library is built in -fvisibility=hidden mode, only these marked symbols will be exported.
Diffstat (limited to 'lib/lz4frame.h')
-rw-r--r--lib/lz4frame.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/lz4frame.h b/lib/lz4frame.h
index 9d9fe89..f33eee1 100644
--- a/lib/lz4frame.h
+++ b/lib/lz4frame.h
@@ -63,11 +63,15 @@ extern "C" {
/*
* LZ4_DLL_EXPORT :
* Enable exporting of functions when building a Windows DLL
+* LZ4FLIB_API :
+* Control library symbols visibility.
*/
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
# define LZ4FLIB_API __declspec(dllexport)
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
# define LZ4FLIB_API __declspec(dllimport)
+#elif defined(__GNUC__) && (__GNUC__ >= 4)
+# define LZ4FLIB_API __attribute__ ((__visibility__ ("default")))
#else
# define LZ4FLIB_API
#endif