[SPEC2DEF] Fix imports of C++ stdcall exports

Too much mangling mangles it too much
This commit is contained in:
Jérôme Gardou 2021-04-29 15:30:59 +02:00 committed by Jérôme Gardou
parent ec68a3311f
commit a8255233f8

View file

@ -576,6 +576,9 @@ PrintName(FILE *fileDest, EXPORT *pexp, PSTRING pstr, int fDeco)
((pexp->nCallingConvention == CC_STDCALL) || ((pexp->nCallingConvention == CC_STDCALL) ||
(pexp->nCallingConvention == CC_FASTCALL))) (pexp->nCallingConvention == CC_FASTCALL)))
{ {
/* Beware with C++ exports */
int is_cpp = pcName[0] == '?';
/* Scan for a dll forwarding dot */ /* Scan for a dll forwarding dot */
pcDot = ScanToken(pcName, '.'); pcDot = ScanToken(pcName, '.');
if (pcDot) if (pcDot)
@ -593,8 +596,8 @@ PrintName(FILE *fileDest, EXPORT *pexp, PSTRING pstr, int fDeco)
pcAt = ScanToken(pcName, '@'); pcAt = ScanToken(pcName, '@');
if (pcAt && (pcAt < (pcName + nNameLength))) if (pcAt && (pcAt < (pcName + nNameLength)))
{ {
/* On GCC, we need to remove the leading stdcall underscore */ /* On GCC, we need to remove the leading stdcall underscore, but not for C++ exports */
if (!gbMSComp && (pexp->nCallingConvention == CC_STDCALL)) if (!gbMSComp && !is_cpp && (pexp->nCallingConvention == CC_STDCALL))
{ {
pcName++; pcName++;
nNameLength--; nNameLength--;
@ -712,8 +715,9 @@ OutputLine_def_GCC(FILE *fileDest, EXPORT *pexp)
bTracing = 1; bTracing = 1;
} }
/* Special handling for stdcall and fastcall */ /* Special handling for stdcall and fastcall, but not C++ exports*/
if ((giArch == ARCH_X86) && if ((giArch == ARCH_X86) &&
(pexp->strName.buf[0] != '?') &&
((pexp->nCallingConvention == CC_STDCALL) || ((pexp->nCallingConvention == CC_STDCALL) ||
(pexp->nCallingConvention == CC_FASTCALL))) (pexp->nCallingConvention == CC_FASTCALL)))
{ {