MinGW g++ requires initialized selectany to have extern linkage. We also defines WCHAR as char16_t, so it cannot be initialized from L"" strings.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- tools/widl/header.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/widl/header.c b/tools/widl/header.c index b8fe3c1c445..bff51815fcd 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -1890,8 +1890,12 @@ static void write_runtimeclass(FILE *header, type_t *runtimeclass) fprintf(header, "#ifndef RUNTIMECLASS_%s_DEFINED\n", c_name); fprintf(header, "#define RUNTIMECLASS_%s_DEFINED\n", c_name); fprintf(header, "#if defined(_MSC_VER) || defined(__MINGW32__)\n"); + fprintf(header, "#ifdef __cplusplus\n"); + fprintf(header, "extern const DECLSPEC_SELECTANY wchar_t RuntimeClass_%s[] = L"%s";\n", c_name, name); + fprintf(header, "#else\n"); /* FIXME: MIDL generates extern const here but GCC warns if extern is initialized */ fprintf(header, "const DECLSPEC_SELECTANY WCHAR RuntimeClass_%s[] = L"%s";\n", c_name, name); + fprintf(header, "#endif\n"); fprintf(header, "#else\n"); fprintf(header, "static const WCHAR RuntimeClass_%s[] = {", c_name); for (i = 0, len = strlen(name); i < len; ++i) fprintf(header, "'%c',", name[i]);