-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
msvc compilation issue with "Simplify windows handling (#1903)" #1904
Comments
I wasn't able to repro this: https://ci.appveyor.com/project/vitaut/fmt/builds/35421078. Please provide the full error message including source locations. |
Hello, Please find attached and example, at line 2886 of format-inl.h you'll find a comment out 'WriteConsoleW' that works Complete error is: Thank you very much |
I tried to repro on godbolt since I don't have a Windows machine at hand, but to no avail: https://godbolt.org/z/fYhcbW. What MSVC version do you use? |
In godbolt I can reproduce it if I remove the namespace detail, and I'm at a loss with this, because if the namespaces are different we shouldn't have a conflict, or I'm missing something My version is: godbold sdk is 10.0.18362.0 |
Got it, its related with the Conformance mode /permissive- |
Thanks for the repro; should be fixed in 79694d4. |
Fixed declspecs in 3ae8814. |
Good day,
If in your code you already include <windows.h>, this commit causes some problems,
As is it will cause the following error
error C2733: 'WriteConsoleW': you cannot overload a function with 'extern "C"' linkage
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\consoleapi.h(244,1): message : see declaration of 'WriteConsoleW'
I've trying changing the signature back to using Windows defines to see what happens and then I get
extern "C" BOOL __stdcall WriteConsoleW( HANDLE hConsoleOutput,
CONST VOID* lpBuffer,
DWORD nNumberOfCharsToWrite,
LPDWORD lpNumberOfCharsWritten,
LPVOID lpReserved );
warning C4273: 'WriteConsoleW': inconsistent dll linkage
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\consoleapi.h(244,1): message : see previous definition of 'WriteConsoleW'
The best compromise I manage was to use your signature but change the extern "C" to __declspec( dllimport )
__declspec( dllimport ) int __stdcall WriteConsoleW( void* hConsoleOutput,
const void* lpBuffer,
uint32_t nNumberOfCharsToWrite,
uint32_t* lpNumberOfCharsWritten,
void* lpReserved );
Thank very much for your wonderful library
Nelson
The text was updated successfully, but these errors were encountered: