Skip to content

Commit

Permalink
Bug #107, 从根源解决依赖threadSafeInit问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mingkuang-Chuyu committed Jul 25, 2024
1 parent 904ed89 commit 4682629
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ goto:eof
:BuildObj
echo BuildObj %1 %2 %3

cl /O1 /Os /Oi /GS- /std:c++17 /execution-charset:utf-8 /Zc:threadSafeInit- /Zc:sizedDealloc- /Zc:tlsGuards- /Zc:alignedNew- /arch:IA32 /Z7 /MT /Fo"objs\\%Platform%\\%1" /Zl /c /D "NDEBUG" /D "YY_Thunks_Target=%2" "%~dp0Thunks\YY_Thunks.cpp"
cl /O1 /Os /Oi /GS- /std:c++17 /execution-charset:utf-8 /Zc:sizedDealloc- /Zc:tlsGuards- /Zc:alignedNew- /arch:IA32 /Z7 /MT /Fo"objs\\%Platform%\\%1" /Zl /c /D "NDEBUG" /D "YY_Thunks_Target=%2" "%~dp0Thunks\YY_Thunks.cpp"
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel%

::生成weak符号,一些非必须符号安排为weak可以避免链接失败
Expand All @@ -52,7 +52,7 @@ echo BuildLib %1 %2 %3

md "Lib\\%1\\%Platform%"

cl /O1 /Os /Oi /GS- /std:c++17 /execution-charset:utf-8 /Zc:threadSafeInit- /Zc:sizedDealloc- /Zc:tlsGuards- /Zc:alignedNew- /arch:IA32 /Z7 /MT /Fo"Lib\\%1\\%Platform%\\YY_Thunks_for_%1.obj" /Zl /c /D "__APPLY_CHROMIUM_WORKAROUNDS" /D "__USING_NTDLL_LIB" /D "NDEBUG" /D "YY_Thunks_Target=%2" /D "__FALLBACK_PREFIX=YY_Thunks_" "%~dp0Thunks\YY_Thunks.cpp"
cl /O1 /Os /Oi /GS- /std:c++17 /execution-charset:utf-8 /Zc:sizedDealloc- /Zc:tlsGuards- /Zc:alignedNew- /arch:IA32 /Z7 /MT /Fo"Lib\\%1\\%Platform%\\YY_Thunks_for_%1.obj" /Zl /c /D "__APPLY_CHROMIUM_WORKAROUNDS" /D "__USING_NTDLL_LIB" /D "NDEBUG" /D "YY_Thunks_Target=%2" /D "__FALLBACK_PREFIX=YY_Thunks_" "%~dp0Thunks\YY_Thunks.cpp"

if %ErrorLevel% NEQ 0 exit /b %ErrorLevel%

Expand Down
9 changes: 8 additions & 1 deletion src/Thunks/YY_Thunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ namespace YY::Thunks::internal
void* __CRTDECL operator new(
size_t _Size,
void* _Block
)
) noexcept
{
return _Block;
}
Expand Down Expand Up @@ -487,6 +487,13 @@ namespace YY::Thunks::internal
{
Free(_Block);
}

void __CRTDECL operator delete(
void* _Block,
void*
) noexcept
{
}
};


Expand Down
2 changes: 1 addition & 1 deletion src/Thunks/api-ms-win-core-threadpool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ namespace YY::Thunks::Fallback
static_assert(sizeof(TaskRunnerFlags) == sizeof(uint64_t));

public:
TP_Pool(bool _bDefault = false)
constexpr TP_Pool(bool _bDefault = false)
: uRef(_bDefault ? UINT32_MAX : 1)
{
}
Expand Down

0 comments on commit 4682629

Please sign in to comment.