https://issues.dlang.org/show_bug.cgi?id=24129
--- Comment #2 from Jeffrey H. Johnson <tr...@pobox.com> --- (In reply to Walter Bright from comment #1) > The problem stems from when a.c and b.c are compiled together, as in: > > dmd a.c b.c > > The code from both gets placed in one object file, a.obj. Hence there are > two copies of __acrt_local_get_ctype_array value, and they conflict with > each other. > > The workaround is to compile them separately. Thanks Walter! Do you think this might be something that can be worked around? The reason is performance, for example, on Linux: $ for i in *.c; do dmd -m64 -fPIC -fPIE -O -release -check=off -boundscheck=off "${i}" -c -of=objout/${i}.o; done $ dmd -m64 -fPIC -fPIE -O -release -check=off -boundscheck=off objout/*.o -of=test1 $ strip test1 $ ls -la test1 885 KB Wed Sep 6 19:29:54 2023 test1* $ rm -rf objout/* $ dmd -m64 -fPIC -fPIE -O -release -check=off -boundscheck=off *.c -of=test2 $ strip test2 $ ls -la test2 838 KB Wed Sep 6 19:30:27 2023 test2* It's quite close, but I can show (with statistical confidence) that the test2 build is a bit faster than test1 (in addition to being smaller and easier to compile). I assume that this is due to some linker optimizations? Does the compiler optimize better, almsot a "poor mans LTO" and treating it as a single translation unit, perhaps? I believe that using -inline (when it works, I made bug #24131 for that) also results in faster binaries when they are all built together, rather than separately. However, as a workaround, this seems acceptable for now, thank you so much. And I assume this is still a bug, so I'll leave this open for now. --