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

On the ABI compatibility of std::future #5260

Closed
PiliLatiesa opened this issue Jan 31, 2025 · 2 comments
Closed

On the ABI compatibility of std::future #5260

PiliLatiesa opened this issue Jan 31, 2025 · 2 comments
Labels
invalid This issue is incorrect or by design

Comments

@PiliLatiesa
Copy link

The following program:

#include <future>
#include <iostream>

void Fn() {}

int main()
{
  std::future<void> Future;
  
  Future = std::async(std::launch::async, Fn);
  
  Future.get();
  
  std::cin.get();
  
  return 0;
}

compiled with:

cl Source.cpp /EHsc /O2 /MD
Compilador de optimización de C/C++ de Microsoft (R) versión 19.42.34436 para x86
(C) Microsoft Corporation. Todos los derechos reservados.

Source.cpp
Microsoft (R) Incremental Linker Version 14.42.34436.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:Source.exe
Source.obj

crashes when executed on a computer with the MSVC redistributable version 14.29.30135 installed.

Isn't this combination supposed to work?

@PiliLatiesa PiliLatiesa added the question Further information is requested label Jan 31, 2025
@YexuanXiao
Copy link
Contributor

You should ensure that the runtime version is at least the STL header files version.

@StephanTLavavej StephanTLavavej added invalid This issue is incorrect or by design and removed question Further information is requested labels Feb 1, 2025
@StephanTLavavej
Copy link
Member

@YexuanXiao is correct. You're probably encountering the mutex change that shipped in VS 2022 17.10. As https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1710 explains:

  • Fixed bugs:
    • Fixed mutex's constructor to be constexpr. #3824 #4000 #4339
      • Note: Programs that aren't following the documented restrictions on binary compatibility may encounter null dereferences in mutex machinery. You must follow this rule:

        When you mix binaries built by different supported versions of the toolset, the Redistributable version must be at least as new as the latest toolset used by any app component.

      • You can define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR as an escape hatch.

@StephanTLavavej StephanTLavavej closed this as not planned Won't fix, can't repro, duplicate, stale Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This issue is incorrect or by design
Projects
None yet
Development

No branches or pull requests

3 participants