Open TsXor opened 1 year ago
I just literally froze when I saw hundreds of errors from \<vector>.
My suggestion is defining all proprietary things with __windivert_
prefix.
From memory, the __in
/__out
annotations are from Microsoft header files. But these annotations do not exist in MinGW, so the #undef
s attempt to "remove" the annotations. However, this seems to clash with some C++ headers which happen to use these names as variable names.
The fix maybe is to just remove the annotations completely from windivert.h
.
From memory, the
__in
/__out
annotations are from Microsoft header files. But these annotations do not exist in MinGW, so the#undef
s attempt to "remove" the annotations. However, this seems to clash with some C++ headers which happen to use these names as variable names.The fix maybe is to just remove the annotations completely from
windivert.h
.
I just checked my MSVC and MinGW installation, and they both have a header called sal.h
.
In that header, they defined such semantic annotations. Something like _In_
, _Out_
, _Inout_
is available.
It's included in windows.h
, so we can use it freely as everyone is supposed to avoid this.
(In the sal.h
there is a FIXME telling this:)
/* FIXME: __in macro conflicts with argument names in libstdc++. For this reason,
* we disable it for C++. This should be fixed in libstdc++ so we can uncomment
* it in fixed version here. */
#if !defined(__cplusplus) || !defined(__GNUC__)
#define __in
#define __out
#endif
btw, we only need to include the following files in windivert.h
after all
#include <minwindef.h>
#include <minwinbase.h>
#include <sal.h>
following snippet will not compile under mingw-w64
mingw version:
compilation error:
We can see this at L49 of
windivert.h
.It seems that this line broke the STL by replacing ALL
__out
to nothingAlso, the snippet will succeed to compile if I add the following before the tail of include guard (I mean
#endif /* __WINDIVERT_H */
):