-
-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
bugSomething isn't workingSomething isn't working
Description
WIndows GNU ABI has different mangling than MSVC ABI, so the linker symbol aliases for GetLastError / FormatMessage etc don't work.
These aliases instead would work:
#if defined(__MINGW32__)
#if defined(__x86_64__)
#pragma comment(linker, "/alternatename:_ZN13system_error25win3212GetLastErrorEv=GetLastError")
#pragma comment(linker, "/alternatename:_ZN13system_error25win3214FormatMessageWEmPKvmmPwmPv=FormatMessageW")
#pragma comment(linker, "/alternatename:_ZN13system_error25win3219WideCharToMultiByteEjmPKwiPciPKcPi=WideCharToMultiByte")
#elif defined(__i386__)
#pragma comment(linker, "/alternatename:__ZN13system_error25win3212GetLastErrorEv@0=__imp__GetLastError@0")
#pragma comment(linker, "/alternatename:__ZN13system_error25win3214FormatMessageWEmPKvmmPwmPv@28=__imp__FormatMessageW@28")
#pragma comment(linker, "/alternatename:__ZN13system_error25win3219WideCharToMultiByteEjmPKwiPciPKcPi@32=__imp__WideCharToMultiByte@32")
#else
#error Unknown architecture
#endif
#else
...
#endif
The above is enough to get it working with clang/lld targeting MINGW64 / GNU ABI (which is only what I need personally).
GCC / ld however do not support neither the #pragma comment nor /alternatename, so a different strategy is needed there.
jcelerier
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working