diff options
author | Alexei Podtelezhnikov <apodtele@gmail.com> | 2018-02-04 00:09:02 -0500 |
---|---|---|
committer | Alexei Podtelezhnikov <apodtele@gmail.com> | 2018-02-04 00:09:02 -0500 |
commit | f4a3255d450e18e4981074ef9a42a2318f9e7cbc (patch) | |
tree | 42a95aaf0c9c6c922f6bf15072b2e7a1214ece75 /builds/vms | |
parent | 036bdc0c9a4fb55b4fe5a7276e97b70b95c8a260 (diff) | |
download | freetype2-f4a3255d450e18e4981074ef9a42a2318f9e7cbc.tar.gz |
[unix] Use -fvisibility=hidden.
It is now widely recommended that ELF shared libraries hide symbols
except those with explicit __attribute__((visibility("default"))).
This is supported by all major compilers and should rather be an
option in libtool.
* builds/unix/configure.raw: Add -fvisibility=hidden to CFLAGS.
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_EXPORT): Use visibility
attribute.
Diffstat (limited to 'builds/vms')
-rw-r--r-- | builds/vms/ftconfig.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h index d87ea69c3..021e2c651 100644 --- a/builds/vms/ftconfig.h +++ b/builds/vms/ftconfig.h @@ -406,9 +406,9 @@ FT_BEGIN_HEADER #endif /* !FT_BASE_DEF */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special attribute in front OR after the return type of function */ - /* declarations. */ + /* When compiling FreeType as a DLL or DSO with hidden visibility */ + /* some systems/compilers need a special attribute in front OR after */ + /* the return type of function declarations. */ /* */ /* Two macros are used within the FreeType source code to define */ /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ @@ -439,21 +439,28 @@ FT_BEGIN_HEADER /* */ #ifndef FT_EXPORT -#ifdef __cplusplus +#ifdef FT2_BUILD_LIBRARY + +#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) ) +#define FT_EXPORT( x ) __declspec( dllexport ) x +#elif defined( __GNUC__ ) && __GNUC__ >= 4 +#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x +#elif defined( __cplusplus ) #define FT_EXPORT( x ) extern "C" x #else #define FT_EXPORT( x ) extern x #endif -#ifdef _WIN32 -#if defined( FT2_BUILD_LIBRARY ) && \ - ( defined( _DLL ) || defined( DLL_EXPORT ) ) -#undef FT_EXPORT -#define FT_EXPORT( x ) __declspec( dllexport ) x -#elif defined( FT2_DLLIMPORT ) -#undef FT_EXPORT +#else + +#if defined( FT2_DLLIMPORT ) #define FT_EXPORT( x ) __declspec( dllimport ) x +#elif defined( __cplusplus ) +#define FT_EXPORT( x ) extern "C" x +#else +#define FT_EXPORT( x ) extern x #endif + #endif #endif /* !FT_EXPORT */ |