Re: [Mingw-w64-public] [PATCH] crt: msvcrt.def.in: Fix _swprintf/_vswprintf symbol aliases
On Tuesday 09 April 2024 22:24:06 LIU Hao wrote: > A little suggestion: If I was to import these functions, I would not add > `swprintf` due to the inconsistency. For example, MSVCR120.DLL does not > export `swprintf`, but only `_swprintf` and two C++ overloads; C++ names are > mangled so they can never match each other. Maybe it's possible to add > `swprintf` as an alias to the C99 one..? Yesterday, I was thinking about it and has similar idea. Export "swprintf" symbol to be C99-compatible and export "_swprintf" symbol to be MSVC-compatible (without maxlen). It should be possible but it is needed to also update header files and ensure that they would never emit "swprintf" symbol for MSVC compatibility. But before that I'm planning to look at cleaning up of symbol aliases. ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: msvcrt.def.in: Fix _swprintf/_vswprintf symbol aliases
在 2024-04-09 02:02, Pali Rohár 写道: Symbols _swprintf and _vswprintf were added in Windows Vista and have same meaning as symbols without leading underscore in msvcrt.dll. These symbols (both with and without leading underscore) differs from C99 variant as they do not take maxlen parameter. For compatibility with pre-Vista systems, which are x86-only, define _swprintf and _vswprintf symbols on I386 and X64 as aliases to swprintf and vswprintf. --- mingw-w64-crt/lib-common/msvcrt.def.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) This change looks good to me, so I pushed this. A little suggestion: If I was to import these functions, I would not add `swprintf` due to the inconsistency. For example, MSVCR120.DLL does not export `swprintf`, but only `_swprintf` and two C++ overloads; C++ names are mangled so they can never match each other. Maybe it's possible to add `swprintf` as an alias to the C99 one..? -- Best regards, LIU Hao OpenPGP_signature.asc Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] crt: msvcrt.def.in: Fix _swprintf/_vswprintf symbol aliases
Symbols _swprintf and _vswprintf were added in Windows Vista and have same meaning as symbols without leading underscore in msvcrt.dll. These symbols (both with and without leading underscore) differs from C99 variant as they do not take maxlen parameter. For compatibility with pre-Vista systems, which are x86-only, define _swprintf and _vswprintf symbols on I386 and X64 as aliases to swprintf and vswprintf. --- mingw-w64-crt/lib-common/msvcrt.def.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 2a592599dbb5..05b0f394713f 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1530,7 +1530,7 @@ _strupr_l _strupr_s _strupr_s_l _strxfrm_l -_swprintf == swprintf ; replaced by alias to swprintf +_swprintf F_X86_ANY(== swprintf) ; i386 and x64 _swprintf replaced by alias _swprintf_c _swprintf_c_l _swprintf_p_l @@ -1589,7 +1589,7 @@ _vsprintf_l _vsprintf_p _vsprintf_p_l _vsprintf_s_l -_vswprintf F_I386(== vswprintf) ; i386 _vswprintf replaced by alias +_vswprintf F_X86_ANY(== vswprintf) ; i386 and x64 _vswprintf replaced by alias _vswprintf_c _vswprintf_c_l _vswprintf_l -- 2.20.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public