From 86a37c05846ff3772afd1300f135866dd1d271c6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 3 Mar 2009 23:32:37 +0100 Subject: [PATCH] Simplify usage recipe for HAVE_VISIBILITY. --- ChangeLog | 3 +++ doc/visibility.texi | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e53002ed..86a78527e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-03-03 Bruno Haible + * doc/visibility.texi: Recommend to use HAVE_VISIBILITY as a C macro. + Reported by Simon Josefsson. + * doc/ld-version-script.texi: Update node reference. 2009-03-03 Bruno Haible diff --git a/doc/visibility.texi b/doc/visibility.texi index 73c743266..0d9b8e334 100644 --- a/doc/visibility.texi +++ b/doc/visibility.texi @@ -102,7 +102,7 @@ of shared libraries. The gnulib autoconf macro @code{gl_VISIBILITY} tests for GCC 4.0 or newer. It defines a Makefile variable @code{@@CFLAG_VISIBILITY@@} containing @samp{-fvisibility=hidden} or nothing. It also defines as a C macro and -as a Makefile variable: @@HAVE_VISIBILITY@@. Its value is 1 when symbol +as a substituted variable: @@HAVE_VISIBILITY@@. Its value is 1 when symbol visibility control is supported, and 0 otherwise. To use this module in a library, say libfoo, you will do these steps: @@ -120,7 +120,7 @@ for the compilation of the sources that make up the library. @item Define a macro specific to your library like this. @smallexample -#if @@HAVE_VISIBILITY@@ && BUILDING_LIBFOO +#if BUILDING_LIBFOO && HAVE_VISIBILITY #define LIBFOO_DLL_EXPORTED __attribute__((__visibility__("default"))) #else #define LIBFOO_DLL_EXPORTED @@ -148,9 +148,9 @@ your library. Note about other compilers: MSVC support can be added easily, by extending the definition of the macro mentioned above, to something like this: @smallexample -#if @@HAVE_VISIBILITY@@ && BUILDING_LIBFOO +#if BUILDING_LIBFOO && HAVE_VISIBILITY #define LIBFOO_DLL_EXPORTED __attribute__((__visibility__("default"))) -#elif defined _MSC_VER && BUILDING_LIBFOO +#elif BUILDING_LIBFOO && defined _MSC_VER #define LIBFOO_DLL_EXPORTED __declspec(dllexport) #elif defined _MSC_VER #define LIBFOO_DLL_EXPORTED __declspec(dllimport) -- 2.11.0