GCC: Stop exporting symbols which should not be exported

Previously, functions that were just used internally in FluidSynth
were still visible to users of the library. No application should
ever use them anyway, as they were only visible at the ABI level,
and not listed in the public API headers.

The big question here is whether this requires a major library bump. I've been
trying to inform myself by looking around the Internet but I haven't come to a
conclusion. E g, the libtool manual just says "interfaces" without specifying
whether they mean API or ABI.

From a pragmatic standpoint, I'm leaning towards *not* bumping the major
library version, because doing so is a major pain for Linux distributions:
they will have to make one "libfluidsynth1" and one "libfluidsynth2"
package, and in turn update everything using that library to depend on
libfluidsynth2 instead of libfluidsynth1.

Sure, there is a risk that some software out there is using one of these hidden
symbols. But I'd say that risk is quite low. And if they are, they're broken
anyway.

In short, I prefer being nice to our downstreams, over being nice to terribly
broken hacky applications that probably don't even exist.

Signed-off-by: David Henningsson <diwic@ubuntu.com>
This commit is contained in:
David Henningsson 2014-03-22 18:10:22 +01:00
parent f10478b30b
commit ee54995fab
2 changed files with 5 additions and 3 deletions

View file

@ -141,9 +141,9 @@ if ( CMAKE_COMPILER_IS_GNUCC )
"${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
endif ( NOT APPLE AND NOT OS2 )
set ( GNUCC_WARNING_FLAGS "-Wall -W -Wpointer-arith -Wbad-function-cast -Wno-cast-qual -Wcast-align -Wstrict-prototypes -Wno-unused-parameter -Wdeclaration-after-statement" )
set ( CMAKE_C_FLAGS_DEBUG "-g -DDEBUG ${GNUCC_WARNING_FLAGS}" )
set ( CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -DNDEBUG ${GNUCC_WARNING_FLAGS}" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -fomit-frame-pointer -funroll-all-loops -finline-functions -DNDEBUG ${GNUCC_WARNING_FLAGS}" )
set ( CMAKE_C_FLAGS_DEBUG "-g -fvisibility=hidden -DDEBUG ${GNUCC_WARNING_FLAGS}" )
set ( CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -fvisibility=hidden -DNDEBUG ${GNUCC_WARNING_FLAGS}" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -fomit-frame-pointer -funroll-all-loops -finline-functions -fvisibility=hidden -DNDEBUG ${GNUCC_WARNING_FLAGS}" )
endif ( CMAKE_COMPILER_IS_GNUCC )
# Windows

View file

@ -39,6 +39,8 @@ extern "C" {
#elif defined(MACOS9)
#define FLUIDSYNTH_API __declspec(export)
#elif defined(__GNUC__)
#define FLUIDSYNTH_API __attribute__ ((visibility ("default")))
#else
#define FLUIDSYNTH_API
#endif