[m-rev.] for review: Avoid strerror_s on MinGW-w64 for compatibility with Windows XP.

Julien Fischer jfischer at opturion.com
Thu Sep 11 11:28:06 AEST 2014


On Thu, 11 Sep 2014, Peter Wang wrote:

> Branches: master, 14.01
>
> runtime/mercury_runtime_util.c:
> 	As above.
>
> diff --git a/runtime/mercury_runtime_util.c b/runtime/mercury_runtime_util.c
> index a27cb7c..62dd6f1 100644
> --- a/runtime/mercury_runtime_util.c
> +++ b/runtime/mercury_runtime_util.c
> @@ -45,10 +45,13 @@ generic_strerror(char *buf, size_t buflen, int errnum)
> const char *
> MR_strerror(int errnum, char *buf, size_t buflen)
> {
> -#if defined(MR_HAVE_STRERROR_S)
> +#if defined(MR_HAVE_STRERROR_S) && !defined(MR_MINGW)
>     /*
>     ** MSVC has strerror_s.  It also exists in C11 Annex K and is enabled by
>     ** defining a preprocessor macro __STDC_WANT_LIB_EXT1__
> +    **
> +    ** On MinGW-w64, strerror_s results in an undefined reference to strerror_s
> +    ** in MSVCRT.DLL on Windows XP.  Avoid it until we drop support for XP.
>     */
>     if (strerror_s(buf, buflen, errnum) != 0) {
>         generic_strerror(buf, buflen, errnum);

That's fine.

Cheers,
Julien.



More information about the reviews mailing list