Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert the ppltasks change that introduced an ole32.dll dependency #3607

Merged
merged 2 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ function(add_stl_dlls D_SUFFIX REL_OR_DBG)
target_stl_compile_options(msvcp${D_SUFFIX}_eha_objects ${REL_OR_DBG})

add_library(msvcp${D_SUFFIX} SHARED)
target_link_libraries(msvcp${D_SUFFIX} PRIVATE msvcp${D_SUFFIX}_eha_objects msvcp${D_SUFFIX}_objects msvcp${D_SUFFIX}_init_objects "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib" "ole32.lib")
target_link_libraries(msvcp${D_SUFFIX} PRIVATE msvcp${D_SUFFIX}_eha_objects msvcp${D_SUFFIX}_objects msvcp${D_SUFFIX}_init_objects "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib")
set_target_properties(msvcp${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_NAME "msvcp140_base${D_SUFFIX}${VCLIBS_SUFFIX}")
set_target_properties(msvcp${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
set_target_properties(msvcp${D_SUFFIX} PROPERTIES OUTPUT_NAME "msvcp140${D_SUFFIX}${VCLIBS_SUFFIX}")
Expand Down
2 changes: 0 additions & 2 deletions stl/msbuild/stl_base/msvcp.settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
<LinkAdditionalOptions Condition="$(DebugBuild) == 'true'">-opt:ref,noicf $(LinkAdditionalOptions)</LinkAdditionalOptions>
<LinkAdditionalOptions>-nodefaultlib:libcpmt$(BuildSuffix).lib $(LinkAdditionalOptions)</LinkAdditionalOptions>
<LinkAdditionalOptions>-nodefaultlib:$(LibOutputFile) $(LinkAdditionalOptions)</LinkAdditionalOptions>
<LinkingWithMinCore Condition="'$(MsvcpFlavor)' == 'app' or '$(MsvcpFlavor)' == 'onecore'">true</LinkingWithMinCore>
<LinkAdditionalOptions Condition="'$(LinkingWithMinCore)' != 'true'">ole32.lib $(LinkAdditionalOptions)</LinkAdditionalOptions>

<LinkGenerateMapFile>true</LinkGenerateMapFile>
<LinkRelease>true</LinkRelease>
Expand Down
32 changes: 22 additions & 10 deletions stl/src/ppltasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <Windows.h>

#if defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT)
#ifndef UNDOCKED_WINDOWS_UCRT
#pragma warning(push)
#pragma warning(disable : 4265) // non-virtual destructor in base class
Expand All @@ -18,8 +19,7 @@
#include <ctxtcall.h>
#include <mutex>
#include <windows.foundation.diagnostics.h>

#pragma comment(lib, "ole32")
#endif

// This IID is exported by ole32.dll; we cannot depend on ole32.dll on OneCore.
static GUID const Local_IID_ICallbackWithNoReentrancyToApplicationSTA = {
Expand Down Expand Up @@ -219,6 +219,7 @@ namespace Concurrency {
_CRTIMP2 void __thiscall _TaskEventLogger::_LogWorkItemCompleted() {}
#endif

#if defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT)
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Foundation::Diagnostics;
using namespace Microsoft::WRL;
Expand Down Expand Up @@ -289,13 +290,6 @@ namespace Concurrency {
}

_CRTIMP2 bool __cdecl _Task_impl_base::_IsNonBlockingThread() {
// TRANSITION, ABI: This preprocessor directive attempts to fix VSO-1684985 (a bincompat issue affecting VS 2015 code)
// while preserving as much of GH-2654 as possible. When we can break ABI, we should:
// * Remove this preprocessor directive - it should be unnecessary after <ppltasks.h> was changed on 2018-01-12.
// * In <ppltasks.h>, reconsider whether _Task_impl_base::_Wait() should throw invalid_operation;
// it's questionable whether that's conforming, and if users want to block their UI threads, we should let them.
// * Investigate whether we can avoid the ppltasks dependency entirely, making all of these issues irrelevant.
#if defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT)
APTTYPE _AptType;
APTTYPEQUALIFIER _AptTypeQualifier;

Expand All @@ -321,10 +315,28 @@ namespace Concurrency {
break;
}
}
#endif // defined(_CRT_APP) || defined(UNDOCKED_WINDOWS_UCRT)
return false;
}

#else
_CRTIMP2 void __thiscall _ContextCallback::_CallInContext(_CallbackFunction _Func, bool) const {
_Func();
}

_CRTIMP2 void __thiscall _ContextCallback::_Capture() {}

_CRTIMP2 void __thiscall _ContextCallback::_Reset() {}

_CRTIMP2 void __thiscall _ContextCallback::_Assign(void*) {}

_CRTIMP2 bool __cdecl _ContextCallback::_IsCurrentOriginSTA() {
return false;
}

_CRTIMP2 bool __cdecl _Task_impl_base::_IsNonBlockingThread() {
return false;
}
#endif
} // namespace details

#ifdef _CRT_APP
Expand Down