Fix mangling overloaded functions in C API

A previous merge of master used a wrong function in get_mangled_type():
we need Swig_name_mangle_type() and not Swig_name_mangle_string() here,
as it's more readable and, more importantly, backwards-compatible and
doesn't change the identifiers used in the generated C API.
This commit is contained in:
Vadim Zeitlin 2024-06-30 17:49:30 +02:00 committed by Vadim Zeitlin
parent 6848b3ef5c
commit a183c7c980
1 changed files with 3 additions and 1 deletions

View File

@ -2139,7 +2139,9 @@ public:
s += len_enum_prefix;
Printf(result, "e%s", s);
} else {
Printf(result, "%s", Char(Swig_name_mangle_string(SwigType_base(type))));
// Use Swig_name_mangle_type() here and not Swig_name_mangle_string() to get slightly simpler mangled name for templates (notably avoiding "_Sp_" and
// "_SP_" fragments for the parentheses used by SWIG internally around template parameters).
Printf(result, "%s", Char(Swig_name_mangle_type(SwigType_base(type))));
}
Delete(prefix);