diff --git a/configure.ac b/configure.ac index 8ca4d7b7..dfd88e54 100644 --- a/configure.ac +++ b/configure.ac @@ -531,7 +531,7 @@ AH_VERBATIM([FLAC_API_EXPORTS], #endif #endif]) -if test x$enable_shared != "xyes" ; then +if test x$enable_static = "xyes" ; then dnl for correct FLAC_API CPPFLAGS="-DFLAC__NO_DLL $CPPFLAGS" fi diff --git a/include/FLAC++/export.h b/include/FLAC++/export.h index d8dccf54..2d7a8c97 100644 --- a/include/FLAC++/export.h +++ b/include/FLAC++/export.h @@ -55,16 +55,23 @@ * * \{ */ + +/* This has grown quite complicated. FLAC__NO_DLL is used by MSVC sln + * files and CMake, which build either static or shared. autotools can + * build static, shared or **both**. Therefore, DLL_EXPORT, which is set + * by libtool, must override FLAC__NO_DLL on building shared components + */ +#if defined(_WIN32) -#if defined(FLAC__NO_DLL) +#if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT)) #define FLACPP_API - -#elif defined(_WIN32) +#else #ifdef FLACPP_API_EXPORTS #define FLACPP_API __declspec(dllexport) #else #define FLACPP_API __declspec(dllimport) #endif +#endif #elif defined(FLAC__USE_VISIBILITY_ATTR) #define FLACPP_API __attribute__ ((visibility ("default"))) diff --git a/include/FLAC/export.h b/include/FLAC/export.h index 3e3e7648..40f8cea8 100644 --- a/include/FLAC/export.h +++ b/include/FLAC/export.h @@ -56,15 +56,22 @@ * \{ */ -#if defined(FLAC__NO_DLL) -#define FLAC_API +/* This has grown quite complicated. FLAC__NO_DLL is used by MSVC sln + * files and CMake, which build either static or shared. autotools can + * build static, shared or **both**. Therefore, DLL_EXPORT, which is set + * by libtool, must override FLAC__NO_DLL on building shared components + */ +#if defined(_WIN32) -#elif defined(_WIN32) +#if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT)) +#define FLAC_API +#else #ifdef FLAC_API_EXPORTS #define FLAC_API __declspec(dllexport) #else #define FLAC_API __declspec(dllimport) #endif +#endif #elif defined(FLAC__USE_VISIBILITY_ATTR) #define FLAC_API __attribute__ ((visibility ("default")))