[libcxx-commits] [libcxx] [libc++] Fix missing 'get_new_handler()' for Windows builds (PR #150182)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 16 09:11:48 PST 2025
siradam7th wrote:
> > The following PR fixes the missing `get_new_handler()` function for Windows by using the same implementation as other platforms since `<new.h>` in the UCRT is missing this function and only defines `set_new_handler()`
>
> `<new.h>` in the UCRT not only contains `_set_new_handler()` it also contains `_query_new_handler()` which returns a pointer to the current new handler. Isn't it possible to use that function instead of maintaining your own implementation?
- `_query_new_handler()` returns a function pointer of type `_PNH` which has a different signature than what we need, so you'd need to wrap it inside another function that has the correct signature, which then calls the actual function, we already have to do that for `_set_new_handler()`.
- that is not how the STL implements it currently, I'm trying to keep it similar to their implementation.
https://github.com/llvm/llvm-project/pull/150182
More information about the libcxx-commits
mailing list