Add LZ4FLIB_VISIBILITY for controlling library symbol visibility

This commit is contained in:
Indragie Karunaratne 2020-04-26 14:49:34 -07:00
parent f39b79fb02
commit 8ec5ee30be

View File

@ -66,17 +66,22 @@ extern "C" {
*****************************************************************/ *****************************************************************/
/* LZ4_DLL_EXPORT : /* LZ4_DLL_EXPORT :
* Enable exporting of functions when building a Windows DLL * Enable exporting of functions when building a Windows DLL
* LZ4FLIB_API : * LZ4LIB_VISIBILITY :
* Control library symbols visibility. * Control library symbols visibility.
*/ */
#ifndef LZ4FLIB_VISIBILITY
# if defined(__GNUC__) && (__GNUC__ >= 4)
# define LZ4FLIB_VISIBILITY __attribute__ ((visibility ("default")))
# else
# define LZ4FLIB_VISIBILITY
# endif
#endif
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
# define LZ4FLIB_API __declspec(dllexport) # define LZ4FLIB_API __declspec(dllexport) LZ4FLIB_VISIBILITY
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1) #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
# define LZ4FLIB_API __declspec(dllimport) # define LZ4FLIB_API __declspec(dllimport) LZ4FLIB_VISIBILITY
#elif defined(__GNUC__) && (__GNUC__ >= 4)
# define LZ4FLIB_API __attribute__ ((__visibility__ ("default")))
#else #else
# define LZ4FLIB_API # define LZ4FLIB_API LZ4FLIB_VISIBILITY
#endif #endif
#ifdef LZ4F_DISABLE_DEPRECATE_WARNINGS #ifdef LZ4F_DISABLE_DEPRECATE_WARNINGS