Skip to content

Latest commit

 

History

History
149 lines (132 loc) · 4.58 KB

0013-flac.git-b917d456.patch

File metadata and controls

149 lines (132 loc) · 4.58 KB
 
1
From: sezero <sezero@users.sourceforge.net>
Dec 1, 2019
Dec 1, 2019
2
3
4
5
6
Date: Tue, 8 Oct 2019 12:10:20 +0000 (+0300)
Subject: make dllexport work with compilers other than MSVC
X-Git-Url: http://git.xiph.org/?p=flac.git;a=commitdiff_plain;h=b917d456d23c3268cc6f466d720605b713d7b9ff
make dllexport work with compilers other than MSVC
7
8
9
10
11
12
13
14
15
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.
---
diff --git a/configure.ac b/configure.ac
Dec 1, 2019
Dec 1, 2019
16
index 14e2205a..6efefaf5 100644
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- 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
Dec 1, 2019
Dec 1, 2019
43
index 16453621..6776b29c 100644
44
45
46
47
48
49
50
51
52
53
54
55
--- 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
Dec 1, 2019
Dec 1, 2019
56
index d52f0bbb..628fe5fc 100644
57
58
59
60
61
62
63
64
65
66
67
68
--- 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
Dec 1, 2019
Dec 1, 2019
69
index 78550087..7f59ebea 100644
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
--- 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);