C++ on 9x, NT 3.x, NT 4.0 and Win32s¶
The win9x-msvcrt and win9x-crtdll sysroots have libc++, libc++abi and
libunwind too, built by build-cxx.sh for a 386, and their config files
pass -stdlib=libc++:
clang++ --config=win98.cfg -O2 hello.cpp -o hello.exe
clang++ --config=nt351.cfg -O2 hello.cpp -o hello.exe
Their headers are for Windows before 2000 (_WIN32_WINNT 0x0400), for
which the libc++ in clang-dos/llvm also does without what 9x, NT 3.x and
NT 4.0 lack. On top of the 2000/XP code (below):
- threads: a mutex is a count of waiting threads and a semaphore, since 9x
has no
TryEnterCriticalSection;this_thread::yieldisSleep(0). On 9x, which can't get a thread's ID from its handle,std::threadkeeps the IDs of the threads it makes. - files:
<filesystem>andfstreams opened with a wide name call the Unicode functions on NT, found at run time, so no program imports a 9x stub. On 9x and Win32s they convert the name to the ANSI code page (a name that doesn't fit is refused) and call the ANSI function. Status comes fromGetFileAttributesandFindFirstFile, as 9x can't open a directory;renameover a file deletes it first; there are no hard links.SetFilePointerExandCreateHardLinkW(2000) andGetSystemTimeAsFileTime(NT 3.5) are looked up at run time. - crtdll.dll (NT 3.x, Win32s, bare 95): no per-thread locales, so a named locale changes the process locale for each call, and files seek with 32-bit positions.
- atomics: a 486 has no
CMPXCHG8B, so 64-bit ones are calls to the compiler-rt atomic functions inlibgcc.a, which take a lock. The others are calls to its__sync_*functions, which work on a 386 too (see above).
The C runtime is still the system one, msvcrt.dll or crtdll.dll, with
what it lacks (no _l functions, an old printf). The win32-picolibc
sysroot (below) replaces it.