diff --git a/dmd2/root/longdouble.h b/dmd2/root/longdouble.h index 99f91f4d..0e8e4498 100644 --- a/dmd2/root/longdouble.h +++ b/dmd2/root/longdouble.h @@ -34,6 +34,12 @@ typedef volatile long double volatile_longdouble; // template longdouble ldouble(T x) { return (longdouble) x; } #define ldouble(x) ((longdouble)(x)) +#if __MINGW32__ +// MinGW supports 80 bit reals, but the formatting functions map to versions +// from the MSVC runtime by default which don't. +#define sprintf __mingw_sprintf +#endif + inline size_t ld_sprint(char* str, int fmt, longdouble x) { char sfmt[4] = "%Lg"; @@ -41,6 +47,10 @@ inline size_t ld_sprint(char* str, int fmt, longdouble x) return sprintf(str, sfmt, x); } +#if __MINGW32__ +#undef sprintf +#endif + #else #include