diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/crt_compat.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/crt_compat.cpp')
| -rw-r--r-- | Minecraft.Client/crt_compat.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Minecraft.Client/crt_compat.cpp b/Minecraft.Client/crt_compat.cpp new file mode 100644 index 00000000..9b9f92a1 --- /dev/null +++ b/Minecraft.Client/crt_compat.cpp @@ -0,0 +1,28 @@ +// CRT compatibility shim for linking VS2012-era libraries with VS2022 +// Provides symbols removed in the Universal CRT (VS2015+) + +#include <cstdio> +#include <cstring> + +// __iob_func was removed in VS2015. Old code (e.g. libpng) references it. +// Provide a shim that returns the stdio file pointers. +extern "C" FILE* __iob_func(void) +{ + // The old __iob_func returned an array of {stdin, stdout, stderr}. + // In the Universal CRT, these are functions, not a contiguous array. + // We return a static array mimicking the old layout. + static FILE iob[3]; + iob[0] = *stdin; + iob[1] = *stdout; + iob[2] = *stderr; + return iob; +} + +// std::_Winerror_map was an internal MSVC runtime function used by +// std::system_category::message(). Old .lib files compiled with VS2012 +// may reference it. Provide a minimal stub. +namespace std { + const char* _Winerror_map(int) { + return ""; + } +} |
