On Wed Apr 26 19:23:53 2023 +0000, Stefan Dösinger wrote:
I don't claim to understand it myself, but https://gcc.gnu.org/onlinedocs/gcc-4.8.5/cpp/Stringification.html So afaiu the STR macro goes from STR(42) to "42", but STR(D3D_COMPILER_VERSION) gives "D3D_COMPILER_VERSION". So we need an extra macro to expand the D3D_COMPILER_VERSION macro - XSTR(D3D_COMPILER_VERSION) will give 47 (no string, just an int literal), then STR(47) gives us "47" as a string.
Note that I could also sprintf(buffer, "d3dcompiler_%d", D3D_COMPILER_VERSION), but then I'd need an extra buffer and do something at runtime that the preprocessor can do for us.