crt: Fix some symbols with duplicate stdcall suffixes
Some of these functions, such as `ConvertAtJobsToTasks`, are exported with both
undecorated and decorated names, respectively, `ConvertAtJobsToTasks` and
`_ConvertAtJobsToTasks@0`. The decorated names are almost useless for C code
anyway and are removed.
Some other stdcall functions, such as `__fls_getvalue`, are only exported with
decorated names. A new macro `DECORATED_EXPORT()` is introduced for them.
This fixes errors like
#include <stdio.h>
#include <windows.h>
/* This was `__stdcall` in X3DAUDIO1_2.DLL, and changed to `__cdecl` later. */
__declspec(dllimport) void __stdcall X3DAudioCalculate(void*, void*, void*, UINT, void*);
int main(void)
{
printf("X3DAudioCalculate = %p\n", (void*)(INT_PTR) X3DAudioCalculate);
}
which used to result in
test.c:(.text+0xf): undefined reference to `_imp__X3DAudioCalculate@20'
Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-crt/def-include/msvcrt-common.def.in b/mingw-w64-crt/def-include/msvcrt-common.def.in
index 9728b5a..975df5d 100644
--- a/mingw-w64-crt/def-include/msvcrt-common.def.in
+++ b/mingw-w64-crt/def-include/msvcrt-common.def.in
@@ -3,6 +3,9 @@
#define ADD_UNDERSCORE(symbol) symbol == _ ## symbol
#define ADD_DOUBLE_UNDERSCORE(symbol) symbol == __ ## symbol
+// for __cdecl and __stdcall only
+#define DECORATED_EXPORT(symbol) symbol == _ ## symbol
+
ADD_DOUBLE_UNDERSCORE(iscsymf)
ADD_DOUBLE_UNDERSCORE(iscsym)
ADD_DOUBLE_UNDERSCORE(isascii)
diff --git a/mingw-w64-crt/lib32/mstask.def b/mingw-w64-crt/lib32/mstask.def
index 2cc5298..ba8f873 100644
--- a/mingw-w64-crt/lib32/mstask.def
+++ b/mingw-w64-crt/lib32/mstask.def
@@ -18,16 +18,3 @@
SASetAccountInformation@20
SASetNSAccountInformation@12
SetNetScheduleAccountInformation@12
-_ConvertAtJobsToTasks@0@0
-_DllCanUnloadNow@0@0
-_DllGetClassObject@12@12
-_GetNetScheduleAccountInformation@12@12
-_NetrJobAdd@12@12
-_NetrJobDel@12@12
-_NetrJobEnum@20@20
-_NetrJobGetInfo@12@12
-_SAGetAccountInformation@16@16
-_SAGetNSAccountInformation@12@12
-_SASetAccountInformation@20@20
-_SASetNSAccountInformation@12@12
-_SetNetScheduleAccountInformation@12@12
diff --git a/mingw-w64-crt/lib32/msvcr100.def.in b/mingw-w64-crt/lib32/msvcr100.def.in
index e2e0e18..00d9912 100644
--- a/mingw-w64-crt/lib32/msvcr100.def.in
+++ b/mingw-w64-crt/lib32/msvcr100.def.in
@@ -626,8 +626,8 @@
__dllonexit
__doserrno
__dstbias
-___fls_getvalue@4@4
-___fls_setvalue@8@8
+DECORATED_EXPORT(__fls_getvalue@4)
+DECORATED_EXPORT(__fls_setvalue@8)
__fpecode
__free_locale
__get_current_locale
diff --git a/mingw-w64-crt/lib32/msvcr90.def.in b/mingw-w64-crt/lib32/msvcr90.def.in
index 4424adf..c5a70d3 100644
--- a/mingw-w64-crt/lib32/msvcr90.def.in
+++ b/mingw-w64-crt/lib32/msvcr90.def.in
@@ -230,8 +230,8 @@
__dllonexit
__doserrno
__dstbias
-___fls_getvalue@4@4
-___fls_setvalue@8@8
+DECORATED_EXPORT(__fls_getvalue@4)
+DECORATED_EXPORT(__fls_setvalue@8)
__fpecode
__free_locale
__get_app_type
diff --git a/mingw-w64-crt/lib32/msvcr90d.def.in b/mingw-w64-crt/lib32/msvcr90d.def.in
index 2835301..ba7dffa 100644
--- a/mingw-w64-crt/lib32/msvcr90d.def.in
+++ b/mingw-w64-crt/lib32/msvcr90d.def.in
@@ -270,8 +270,8 @@
__dllonexit
__doserrno
__dstbias
-___fls_getvalue@4@4
-___fls_setvalue@8@8
+DECORATED_EXPORT(__fls_getvalue@4)
+DECORATED_EXPORT(__fls_setvalue@8)
__fpecode
__free_locale
__get_app_type
diff --git a/mingw-w64-crt/lib32/msvcrt20.def.in b/mingw-w64-crt/lib32/msvcrt20.def.in
index d2702db..1ac4d47 100644
--- a/mingw-w64-crt/lib32/msvcrt20.def.in
+++ b/mingw-w64-crt/lib32/msvcrt20.def.in
@@ -1168,7 +1168,7 @@
_rotr
_scalb
_searchenv
-__seh_longjmp_unwind@4@4
+DECORATED_EXPORT(_seh_longjmp_unwind@4)
_seterrormode
_setjmp
_setjmp3
diff --git a/mingw-w64-crt/lib32/t2embed.def b/mingw-w64-crt/lib32/t2embed.def
index f186061..7793064 100644
--- a/mingw-w64-crt/lib32/t2embed.def
+++ b/mingw-w64-crt/lib32/t2embed.def
@@ -11,17 +11,6 @@
TTIsEmbeddingEnabledForFacename@8
TTLoadEmbeddedFont@40
TTRunValidationTests@8
-_TTCharToUnicode@24@24
-_TTDeleteEmbeddedFont@12@12
-_TTEmbedFont@44@44
-_TTEmbedFontFromFileA@52@52
-_TTEnableEmbeddingForFacename@8@8
-_TTGetEmbeddedFontInfo@28@28
-_TTGetEmbeddingType@8@8
-_TTIsEmbeddingEnabled@8@8
-_TTIsEmbeddingEnabledForFacename@8@8
-_TTLoadEmbeddedFont@40@40
-_TTRunValidationTests@8@8
TTEmbedFontEx@44
TTRunValidationTestsEx@8
TTGetNewFontName@20
diff --git a/mingw-w64-crt/lib32/usbd.def b/mingw-w64-crt/lib32/usbd.def
index 1b52c7c..b14a766 100644
--- a/mingw-w64-crt/lib32/usbd.def
+++ b/mingw-w64-crt/lib32/usbd.def
@@ -5,16 +5,15 @@
;
LIBRARY "USBD.SYS"
EXPORTS
-; USBD_CreateConfigurationRequestEx@8
-; USBD_ParseConfigurationDescriptorEx@28
-; USBD_ParseDescriptors@16
+USBD_CreateConfigurationRequestEx@8
+USBD_ParseConfigurationDescriptorEx@28
+USBD_ParseDescriptors@16
DllInitialize@4
DllUnload@0
USBD_AllocateDeviceName@4
USBD_CalculateUsbBandwidth@12
USBD_CompleteRequest@8
USBD_CreateConfigurationRequest@8
-; _USBD_CreateConfigurationRequestEx@8@8
USBD_CreateDevice@20
USBD_Debug_GetHeap@16
USBD_Debug_LogEntry@16
@@ -30,8 +29,6 @@
USBD_InitializeDevice@24
USBD_MakePdoName@8
USBD_ParseConfigurationDescriptor@12
-; _USBD_ParseConfigurationDescriptorEx@28@28
-; _USBD_ParseDescriptors@16@16
USBD_QueryBusTime@8
USBD_RegisterHcDeviceCapabilities@12
USBD_RegisterHcFilter@8
@@ -40,6 +37,3 @@
USBD_RestoreDevice@12
USBD_SetSuspendPowerState@8
USBD_WaitDeviceMutex@4
-USBD_CreateConfigurationRequestEx@8==_USBD_CreateConfigurationRequestEx@8
-USBD_ParseConfigurationDescriptorEx@28==_USBD_ParseConfigurationDescriptorEx@28
-USBD_ParseDescriptors@16==_USBD_ParseDescriptors@16
diff --git a/mingw-w64-crt/lib32/x3daudio1_2.def b/mingw-w64-crt/lib32/x3daudio1_2.def
index fb34ad0..b07bf17 100644
--- a/mingw-w64-crt/lib32/x3daudio1_2.def
+++ b/mingw-w64-crt/lib32/x3daudio1_2.def
@@ -5,7 +5,5 @@
;
LIBRARY "X3DAudio1_2.dll"
EXPORTS
-;_X3DAudioCalculate@20@20
-;_X3DAudioInitialize@12@12
-_X3DAudioCalculate@20 == _X3DAudioCalculate@20
-_X3DAudioInitialize@12 == _X3DAudioInitialize@12
+X3DAudioCalculate@20 == _X3DAudioCalculate@20
+X3DAudioInitialize@12 == _X3DAudioInitialize@12