[libcxx-commits] [libcxx] [libc++] Fix missing 'get_new_handler()' for Windows builds (PR #150182)

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 13 12:39:15 PST 2026


mstorsjo wrote:

> > If my understand that we're actually already relying on some symbols from the MSVC STL is true, then I think it'd make a lot more sense to simply declare the functions in our headers and let the MSVC STL always handle the storage of the new handler.
> 
> There are only two APIs we depend on MSVC STL for: `std::get_new_handler`/`std::set_new_handler` and `std::exception_ptr`. If we provide our own implementation, we could drop the dependency on MSVC STL altogether which I believe would address your concern and is desirable for many libc++ users on Windows from what we heard.
> 
> This change implements `std::get_new_handler`/`std::set_new_handler` and #94977 is the implementation of `std::exception_ptr` which was donated by Microsoft but that still needs to be integrated properly into libc++.

Hmm, indeed. I had the impression that we also linked other C++ base ABI symbols from there - but they are provided by the C runtime library; this is the case for e.g. `operator new` at least. And if removing `msvcprt` (MS STL) from the link command, I do indeed only see undefined references to a bunch of `__ExceptionPtr*` symbols when linking the libc++ DLL.

Decoupling libc++ entirely from MS STL would indeed be desireable, and we're probably much closer to being able to do that, than I thought.

So with that in mind, this is probably a reasonable direction after all.

https://github.com/llvm/llvm-project/pull/150182


More information about the libcxx-commits mailing list