lvqcl wrote:
> When I compile flac project with MSYS/MinGW-w64, I can see two files:
> libFLAC.a and libFLAC-static.a. The only difference between them
> is that libFLAC.a contains functions from win_utf8_io.
> But 'make install' adds libFLAC.a into /local/lib, not
libFLAC-static.a.
Thank you for checking this. I've always had trouble with Autotools on
Windows, even when running them from a non-Windows machine first.
> So currently libFLAC on _WIN32 does depend on win_utf8_io.
Does my patch fix this issue on your end?
> BTW, share/compat.h includes share/win_utf8_io.h (if _WIN32 is defined),
> and is included into many libFLAC source files. As a result, some libFLAC
> source files unnecessarily include share/win_utf8_io.h, windows.h, etc.
It looks like win_utf8_io.h only includes windows.h in order to have
the proper types to declare CreateFile_utf8, which is used in
src/flac/decode.c and src/share/grabbag/file.c. I suppose those two
files could #define FLAC__INCLUDE_WINAPI and win_utf8_io.h could guard
the include and CreateFile_utf8 declaration with it, if we wanted to
avoid windows.h. If we wanted to avoid share/win_utf8_io.h completely,
we would need to do something similar in the 34 files that use
flac_(printf|fprintf|vfprintf|fopen|chmod|utime|stat|unlink|rename),
which would be counterproductive to the purpose of compat.h.
On the topic of header minimalism, we may want to #define
WIN32_LEAN_AND_MEAN and NOGDI before every #include <windows.h> in the
codebase.
Janne Hyv?rinen wrote:
> Win_utf8 stuff should not be included in libflac since it's only to be
used
> by the flac.exe frontend. It is not needed by other programs nor would they
> benefit from it without doing the extra work of converting their ansi
> filenames and functions to utf-8.
libFLAC.a(metadata_iterators.release.o): In function
`simple_iterator_prime_input_':
flac/src/libFLAC/metadata_iterators.c:427: undefined reference to
`fopen_utf8'
flac/src/libFLAC/metadata_iterators.c:424: undefined reference to
`fopen_utf8'
libFLAC.a(metadata_iterators.release.o): In function `set_file_stats_':
flac/src/libFLAC/metadata_iterators.c:3355: undefined reference to
`chmod_utf8'
flac/src/libFLAC/metadata_iterators.c:3356: undefined reference to
`utime_utf8'
flac/src/libFLAC/metadata_iterators.c:3355: undefined reference to
`chmod_utf8'
flac/src/libFLAC/metadata_iterators.c:3356: undefined reference to
`utime_utf8'
flac/src/libFLAC/metadata_iterators.c:3355: undefined reference to
`chmod_utf8'
flac/src/libFLAC/metadata_iterators.c:3356: undefined reference to
`utime_utf8'
libFLAC.a(metadata_iterators.release.o): In function
`simple_iterator_prime_input_':
flac/src/libFLAC/metadata_iterators.c:427: undefined reference to
`fopen_utf8'
libFLAC.a(metadata_iterators.release.o): In function `get_file_stats_':
flac/src/libFLAC/metadata_iterators.c:3343: undefined reference to
`_stat64_utf8'
libFLAC.a(metadata_iterators.release.o): In function `set_file_stats_':
flac/src/libFLAC/metadata_iterators.c:3355: undefined reference to
`chmod_utf8'
flac/src/libFLAC/metadata_iterators.c:3356: undefined reference to
`utime_utf8'
libFLAC.a(metadata_iterators.release.o): In function
`simple_iterator_prime_input_':
flac/src/libFLAC/metadata_iterators.c:424: undefined reference to
`fopen_utf8'
libFLAC.a(metadata_iterators.release.o): In function `open_tempfile_':
flac/src/libFLAC/metadata_iterators.c:3284: undefined reference to
`fopen_utf8'
libFLAC.a(metadata_iterators.release.o): In function `cleanup_tempfile_':
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
libFLAC.a(metadata_iterators.release.o):flac/src/libFLAC/metadata_iterators.c:3306:
more undefined references to `unlink_utf8' follow
libFLAC.a(metadata_iterators.release.o): In function `transport_tempfile_':
flac/src/libFLAC/metadata_iterators.c:3314: undefined reference to
`rename_utf8'
libFLAC.a(metadata_iterators.release.o): In function `cleanup_tempfile_':
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
libFLAC.a(metadata_iterators.release.o): In function `set_file_stats_':
flac/src/libFLAC/metadata_iterators.c:3355: undefined reference to
`chmod_utf8'
flac/src/libFLAC/metadata_iterators.c:3356: undefined reference to
`utime_utf8'
libFLAC.a(metadata_iterators.release.o): In function `cleanup_tempfile_':
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
libFLAC.a(metadata_iterators.release.o): In function `chain_read_':
flac/src/libFLAC/metadata_iterators.c:1532: undefined reference to
`fopen_utf8'
flac/src/libFLAC/metadata_iterators.c:1532: undefined reference to
`fopen_utf8'
libFLAC.a(metadata_iterators.release.o): In function `chain_rewrite_file_':
flac/src/libFLAC/metadata_iterators.c:1394: undefined reference to
`fopen_utf8'
libFLAC.a(metadata_iterators.release.o): In function `open_tempfile_':
flac/src/libFLAC/metadata_iterators.c:3284: undefined reference to
`fopen_utf8'
libFLAC.a(metadata_iterators.release.o): In function `cleanup_tempfile_':
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
libFLAC.a(metadata_iterators.release.o): In function `get_file_stats_':
flac/src/libFLAC/metadata_iterators.c:3343: undefined reference to
`_stat64_utf8'
libFLAC.a(metadata_iterators.release.o): In function
`chain_rewrite_metadata_in_place_':
flac/src/libFLAC/metadata_iterators.c:1369: undefined reference to
`fopen_utf8'
libFLAC.a(metadata_iterators.release.o): In function `set_file_stats_':
flac/src/libFLAC/metadata_iterators.c:3355: undefined reference to
`chmod_utf8'
flac/src/libFLAC/metadata_iterators.c:3356: undefined reference to
`utime_utf8'
libFLAC.a(metadata_iterators.release.o): In function `transport_tempfile_':
flac/src/libFLAC/metadata_iterators.c:3306: undefined reference to
`unlink_utf8'
flac/src/libFLAC/metadata_iterators.c:3314: undefined reference to
`rename_utf8'
libFLAC.a(metadata_iterators.release.o): In function `cleanup_tempfile_':
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
flac/src/libFLAC/metadata_iterators.c:3333: undefined reference to
`unlink_utf8'
libFLAC.a(stream_decoder.release.o): In function `init_file_internal_':
flac/src/libFLAC/stream_decoder.c:609: undefined reference to `fopen_utf8'
flac/src/libFLAC/stream_decoder.c:609: undefined reference to `fopen_utf8'
include/share/compat.h, #ifdef _WIN32:
#define flac_fopen fopen_utf8
#define flac_chmod chmod_utf8
#define flac_utime utime_utf8
#define flac_unlink unlink_utf8
#define flac_rename rename_utf8
#define flac_stat _stat64_utf8
The members of the libFLAC API that result in calls to these functions
include FLAC__stream_decoder_init_file,
FLAC__stream_decoder_init_ogg_file, and a variety of metadata
functions. These functions either take a char* filename or use one
stored in a struct. Fortunately, UTF-8 is a superset of 7-bit ASCII.
Best,
Evan