On Mon Jan 19 14:30:57 2026 +0000, Yuxuan Shui wrote:
I did some quick experiments and yeah I was wrong. I have updated the MR to I think is what you have in mind? Yeah, if CRT functions were in winecrt0, then they could take precedence over imported ones. In that case, we could just go back to inlining them in `DllMainCRTStartup`. If we do that, I would suggest inlining everything, instead of using static functions with overlapping names, as in the previous version.
ntdll already serves as a CRT of last resort. From a CRT perspective, treating `initterm` like, for example, `sprintf` and expecting it to always be available seems reasonable to me. That said, it is a bit of a complexity trade-off, so sure, we can avoid that. BTW, https://gitlab.winehq.org/jacek/wine/-/commit/776359eb4856d5c7f006dabff09b87... is somewhat separate from the rest. It is not required for this MR, but it also affects existing modules (windowscodecs, dinput) that already import themselves. It is mostly harmless when everything is correct, but it is easy to make those DLLs import themselves. This was originally handled by 3ad95e03b810906dce87231fd12aa9a1d8f4aad7, but that did not survive later changes. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9265#note_127325