MiroKaku / ucxxrt

The Universal C++ RunTime library, supporting kernel-mode C++ exception-handler and STL.
MIT License
399 stars 97 forks source link

Visual Studio 2022 Preview 适配 #32

Closed ranni0225 closed 1 year ago

ranni0225 commented 1 year ago

Is your feature request related to a problem? Please describe.

新版本MSVC中一些头文件(如xthreads.h)存在较大改动,目前项目在VS2022预览版中无法完成编译。

Describe the solution you'd like Describe alternatives you've considered

似乎可以内嵌旧版本头文件?

Additional context

cond.cpp这种可以简单的批量替换:

1>C:\Projects\WIP\ucxxrt\src\crt\stl\cond.cpp(36,44): error C2556: “int _Cnd_init(_Cnd_t *const )”: 重载函数与“_Thrd_result _Cnd_init(_Cnd_t *)”只是在返回类型上不同

新版本的函数签名:
_CRTIMP2_PURE _Thrd_result __cdecl _Cnd_init(_Cnd_t*);
enum class _Thrd_result : int { _Success, _Nomem, _Timedout, _Busy, _Error };

旧版本的函数签名:
int __cdecl _Cnd_init(_Cnd_t* const pcond);

替换 return _Thrd_XXX -> return _Thrd_result::_XXX

但mutex.cpp中的
static_assert(sizeof(_Mtx_internal_imp_t) <= _Mtx_internal_imp_size, "incorrect _Mtx_internal_imp_size");
static_assert(alignof(_Mtx_internal_imp_t) <= _Mtx_internal_imp_alignment, "incorrect _Mtx_internal_imp_alignment");

这类代码改动较大,可能需要重新适配。
MiroKaku commented 1 year ago

不考虑 Preview 版本。当前架构的缺陷,需要跟随VS版本更新,后面重构后会直接使用本地文件来生成。