Closed selvanair closed 2 years ago
This can be worked around by adding -DWIN32_LEAN_AND_MEAN during build as that will avoid including some headers which lead to the conflict. A reason why this has not be been reported in OpenSC is probably because they build with that define.
However, its not an solution for users of the library as there are many other ways the conflicting #define could get pulled in an application depending on what Windows features are in use (say, Windows sockets, rpc etc.).
@selvanair: I've opened https://github.com/OpenSC/OpenSC/pull/2502
However, I do believe that for the last decade or so every windows project must use WIN32_LEAN_AND_MEAN, I am not sure why Microsoft had not made this the default. There is no reason to build projects without it, in OpenVPN when I re-wrote the build system I am sure I've added this as well.
@alonbl: We do build OpenVPN with WIN32_LEAN_AND_MEAN but we pull in some headers like rpc.h (directly or indirectily) which also defines this offending "interface" keyword. It may be possible to refactor some of that to avoid the conflict, but it looks better to fix it in pkcs11.h.
I agree, as I wrote I created OpenSC/OpenSC#2502 when this merged I will cherry pick it for this project as well.
Unfortunately "interface" is defined as "struct" in one of the Windows headers (basetyps.h) which breaks expansion of a macro in pkcs11.h pkcs11.h line 1213:
I believe MSVC build also must be affected.