[flac-dev] vsnprintf_s and vsnprintf

lvqcl lvqcl.mail at gmail.com
Sat Sep 20 15:58:23 PDT 2014


Erik de Castro Lopo wrote:

>> MSVS version of vsnprintf_s is located inside (statically linked) msvcp???.lib
>> or (dynamically linked) msvcp???.dll. They are part of MSVS runtime, and compatible
>> with WinXP. So it is safe to use it in FLAC.
>
> Oh, ok. I missed this bit. I know so very little about Windows.
>
> However, if you compile flac on say Win7 using vsnprintf_s and then take
> the dynamically compiled binary to WinXP it will fail, right?

No, flac.exe compiled with MSVS 2013 (and dynamically linked with MSVC runtime) will
simply require msvcr120.dll to run. On both OSes.

> Either of those two are fine. You choose and send a patch. I'll write
> a unit test for flac_snprintf to capture our assumptions.

I would like to know opinions of other people... Especially because I'm not
very familiar with MinGW. Anyone?


P.S. There are 3 places where flac uses vsnprintf:
1) flac_snprintf inside src/share/grabbag/snprintf.c
2) local_snprintf inside src/libFLAC/metadata_iterators.c -- but it's a full copy of flac_snprintf
3) printf_utf8/fprintf_utf8/vfprintf_utf8 inside src/share/win_utf8_io/win_utf8_io.c


More information about the flac-dev mailing list