bsnes-emu / bsnes

bsnes is a Super Nintendo (SNES) emulator focused on performance, features, and ease of use.
Other
1.67k stars 154 forks source link

<nall/windows/guard.hpp> is broken on ucrt #198

Closed Morilli closed 3 years ago

Morilli commented 3 years ago

When compiling on ucrt64 mingw, I noticed I get some very weird errors about undefined symbols in stdlib.

I tracked it down to the #define __MSVCRT_VERSION__ WINVER line in <nall/windows/guard.hpp>, which presumably should "fix" some system headers, but because of this hardcoding instead breaks the ucrt build.

I'm not sure what the "right" fix here is, but I suggest

  1. Removing this header altogether; it really doesn't feel right to me at all, or
  2. at least remove all heuristic (re-)defines from it

Perhaps some insight on why this was added / needed? in the first place would be helpful. Fwiw my current (system) define of __MSVCRT_VERSION__ is 0xE00.

Screwtapello commented 3 years ago

I don't know why this was added, but it would be educational to remove it and try building it again (both in UCRT and... traditional(?) mode) just to see what happens.

Morilli commented 3 years ago

From my local testing I see no difference between re-defining __MSVCRT_VERSION__ and not doing it on mingw64, and ucrt64 doesn't build with it re-defined, so can't really test there.

Would suggest just taking at least this define out because it doesn't seem to affect anything on a (modern) build system and I'm not sure potential support for 10 year old compilers is needed.

Screwtapello commented 3 years ago

I would merge a PR that made this change.