I found a way to make a solution for 64 bit Windows mechanically
with many MSVC intrinsics, using only mingw64.
Here's an [MSYS2](https://www.msys2.org/) bash script.
```bash
gcc -E -P intrin.c -o vcintrinsics.c
sed -i 's/extern __inline__
__attribute__((__always_inline__,__gnu_inline__))//g'
vcintrinsics.c
gcc -fPIC -shared -o vcintrinsics.dll vcintrinsics.c
-Wl,--export-all-symbols -Wl,--output-def=vcintrinsics.def
#lib -nologo -machine:x64 -def:vcintrinsics.def
-out:vcintrinsics.lib
dlltool -D vcintrinsics.dll -d vcintrinsics.def -l
vcintrinsics.lib -m i386:x86-64
cp vcintrinsics.dll /c/D/dmd2/windows/bin64/
cp vcintrinsics.lib /c/D/dmd2/windows/lib64/
```
The commented out line is using the MS librarian to do the same
job as the mingw64 libtool. This script builds a dll containing
100+ intrinsics defined in mingw64 and makes an import library
for DMD to use it from a developer command prompt.
`intrin.c` contains only `#include <intrin.h>` and is
preprocessed in the first line into `vcintrinsics.c` which if
examined contains working definitions of many intrinsics but with
`extern __inline__
__attribute__((__always_inline__,__gnu_inline__))` prefixing
them, so they will not compile to actual library functions. The
sed command strips those prefixes out, and the compilation makes
a DLL containing the the intrinsics and a DEF file listing their
names for linkage, ready for dlltool to assemble an import
library suitable for DMD to link to so as to be able to
dynamically link the DLL.
And that's it; so far the result has just worked and I've had no
linkage issues due to missing MSVC intrinsics since. I just put
vcintrinsics.lib on the end of the dmd command line whenever I'm
using real Windows headers in ImportC and the linker has always
been satisfied so far. When I'm done, I can remove vcintrinsics
from the dmd command line, and find out which intrinsics are
actually needed for linking, and using the technique earlier in
the thread above, satisfy those directly, so the result doesn't
need vcintrinsics.dll.
Hopefully DMD will soon know about these MSVC intrinsics but
until then this is an effective way to more-or-less permanently
work around the inevitable linkage problems.