From 5273f2143416f6340f6ee876facfa6f7a87453a0 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Tue, 1 Feb 2011 13:19:18 +0100 Subject: [PATCH] Undefine setlocale() macro on Win32 New versions of libintl redefine setlocale() to a macro which causes problems when the backend and libintl are linked against different versions of the runtime, which is often the case in msvc builds. Hiroshi Inoue, slightly updated comment by me --- src/include/port.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/include/port.h b/src/include/port.h index 4d40cef7b4..2c58b55492 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -176,6 +176,15 @@ extern unsigned char pg_tolower(unsigned char ch); #ifdef printf #undef printf #endif +/* + * Versions of libintl >= 0.18? try to replace setlocale() with a macro + * to their own versions. Remove the macro, if it exists, because it + * ends up calling the wrong version when the backend and libintl use + * different versions of msvcrt. + */ +#if defined(setlocale) && defined(WIN32) +#undef setlocale +#endif extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args); extern int