diff options
author | sezero <sezero@users.sourceforge.net> | 2019-10-08 15:10:20 +0300 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2019-10-10 18:30:39 +1100 |
commit | b917d456d23c3268cc6f466d720605b713d7b9ff (patch) | |
tree | 9f905cab65c0e6b5f7efaccb51cb0640eb1d3708 | |
parent | 19a0e99ac3ac5f1fc24d66612668a277ceba8195 (diff) | |
download | flac-b917d456d23c3268cc6f466d720605b713d7b9ff.tar.gz |
make dllexport work with compilers other than MSVC
the issue is, flac and metaflac exes rely on flac_internal_???_utf8()
procedures from windows_unicode_filenames.c and there is no easy way
to exclude them from exports without breaking things. So export them
explicitly (they are exported anyway w/o this patch), but add a FIXME
note about the kludge in windows_unicode_filenames.c.
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | include/FLAC++/export.h | 2 | ||||
-rw-r--r-- | include/FLAC/export.h | 2 | ||||
-rw-r--r-- | src/libFLAC/windows_unicode_filenames.c | 19 |
4 files changed, 29 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac index 14e2205a..6efefaf5 100644 --- a/configure.ac +++ b/configure.ac @@ -493,6 +493,22 @@ if test x$enable_stack_smash_protection = "xyes" ; then XIPH_GXX_STACK_PROTECTOR fi +AH_VERBATIM([FLAC_API_EXPORTS], +[/* libtool defines DLL_EXPORT for windows dll builds, + but flac code relies on FLAC_API_EXPORTS instead. */ +#ifdef DLL_EXPORT +#ifdef __cplusplus +# define FLACPP_API_EXPORTS +#else +# define FLAC_API_EXPORTS +#endif +#endif]) + +if test x$enable_shared != "xyes" ; then +dnl for correct FLAC_API + CPPFLAGS="-DFLAC__NO_DLL $CPPFLAGS" + fi + AC_CONFIG_FILES([ \ Makefile \ src/Makefile \ diff --git a/include/FLAC++/export.h b/include/FLAC++/export.h index 16453621..6776b29c 100644 --- a/include/FLAC++/export.h +++ b/include/FLAC++/export.h @@ -59,7 +59,7 @@ #if defined(FLAC__NO_DLL) #define FLACPP_API -#elif defined(_MSC_VER) +#elif defined(_WIN32) #ifdef FLACPP_API_EXPORTS #define FLACPP_API __declspec(dllexport) #else diff --git a/include/FLAC/export.h b/include/FLAC/export.h index d52f0bbb..628fe5fc 100644 --- a/include/FLAC/export.h +++ b/include/FLAC/export.h @@ -59,7 +59,7 @@ #if defined(FLAC__NO_DLL) #define FLAC_API -#elif defined(_MSC_VER) +#elif defined(_WIN32) #ifdef FLAC_API_EXPORTS #define FLAC_API __declspec(dllexport) #else diff --git a/src/libFLAC/windows_unicode_filenames.c b/src/libFLAC/windows_unicode_filenames.c index 78550087..7f59ebea 100644 --- a/src/libFLAC/windows_unicode_filenames.c +++ b/src/libFLAC/windows_unicode_filenames.c @@ -37,6 +37,9 @@ #include <windows.h> #include "share/windows_unicode_filenames.h" +/*** FIXME: KLUDGE: export these syms for flac.exe, metaflac.exe, etc. ***/ +#include "FLAC/export.h" + /* convert UTF-8 back to WCHAR. Caller is responsible for freeing memory */ static wchar_t *wchar_from_utf8(const char *str) { @@ -61,19 +64,19 @@ static wchar_t *wchar_from_utf8(const char *str) static FLAC__bool utf8_filenames = false; -void flac_internal_set_utf8_filenames(FLAC__bool flag) +FLAC_API void flac_internal_set_utf8_filenames(FLAC__bool flag) { utf8_filenames = flag ? true : false; } -FLAC__bool flac_internal_get_utf8_filenames(void) +FLAC_API FLAC__bool flac_internal_get_utf8_filenames(void) { return utf8_filenames; } /* file functions */ -FILE* flac_internal_fopen_utf8(const char *filename, const char *mode) +FLAC_API FILE* flac_internal_fopen_utf8(const char *filename, const char *mode) { if (!utf8_filenames) { return fopen(filename, mode); @@ -95,7 +98,7 @@ FILE* flac_internal_fopen_utf8(const char *filename, const char *mode) } } -int flac_internal_stat64_utf8(const char *path, struct __stat64 *buffer) +FLAC_API int flac_internal_stat64_utf8(const char *path, struct __stat64 *buffer) { if (!utf8_filenames) { return _stat64(path, buffer); @@ -111,7 +114,7 @@ int flac_internal_stat64_utf8(const char *path, struct __stat64 *buffer) } } -int flac_internal_chmod_utf8(const char *filename, int pmode) +FLAC_API int flac_internal_chmod_utf8(const char *filename, int pmode) { if (!utf8_filenames) { return _chmod(filename, pmode); @@ -127,7 +130,7 @@ int flac_internal_chmod_utf8(const char *filename, int pmode) } } -int flac_internal_utime_utf8(const char *filename, struct utimbuf *times) +FLAC_API int flac_internal_utime_utf8(const char *filename, struct utimbuf *times) { if (!utf8_filenames) { return utime(filename, times); @@ -146,7 +149,7 @@ int flac_internal_utime_utf8(const char *filename, struct utimbuf *times) } } -int flac_internal_unlink_utf8(const char *filename) +FLAC_API int flac_internal_unlink_utf8(const char *filename) { if (!utf8_filenames) { return _unlink(filename); @@ -162,7 +165,7 @@ int flac_internal_unlink_utf8(const char *filename) } } -int flac_internal_rename_utf8(const char *oldname, const char *newname) +FLAC_API int flac_internal_rename_utf8(const char *oldname, const char *newname) { if (!utf8_filenames) { return rename(oldname, newname); |