It’s difficult for me to give you a repo because the whole thing relies on our custom runtime. I’ll give you a brief description of what I have though.
I’m just creating a dll and linking against the static windows CRT. I rely on the MSVC _CRT_INIT function to call static ctrs so I basically get whatever MSVC gives me. The offending code is as simple as:
std::cout << std::endl;
in a “main” function. main being the first (significant) thing I call after _CRT_INIT has returned.
Obviously no guarantees you’d be able to repro given we both probably have changed the source and likely have quite different runtimes.
Re generally porting to msvc. I’ve spent some fairly painful time getting as far as I have. Many of the issues I’ve faced relate to working around MS’s poor compiler support for MSVC. There are numerous changes that I think would be beneficial to the code base. I haven’t made any progress with trying to submit them because:
a) I’m too busy.
b) I’m not familiar with the submission process.
c) I don’t know whether changes would be readily accepted based on me saying “this fixes X with MSVC”. Is there any automated testing for MSVC? Would moderators accept code on the basis that “it doesn’t break anything else and trust me it makes Windows better”?
Roughly the changes I’ve made fall into 3 categories:
- Workarounds for poor compiler support.
- Fixes to libc++ fallbacks when certain features aren’t available. For example, when _LIBCPP_HAS_NO_VARIADICS is defined the fallbacks for certain code don’t actually work.
- Minor bug fixes to libcpp (there are very few in this category and mostly innocuous).