On Wednesday, 20 May 2020 at 18:53:01 UTC, NonNull wrote:
Which D compiler should be used to be ABI compatible with mingw32? And which to be ABI compatible with mingw64?

The natural choice for coupling mingw[64]-gcc would be GDC. Especially wrt. ABI, gdc apparently doesn't have to do much by itself, in sharp contrast to LDC. No idea where gdc's MinGW[-w64] support is at though and whether you need more recent D features not available in gdc.

Wrt. LDC, I think the C ABI for the `-mtriple=x86_64-windows-gnu` target should be okay. IIRC, MinGW mostly adheres to Microsoft's official Win64 ABI and mostly just diverges wrt. `real` (80-bit x87 C `long double` vs. 64-bit double precision for MSVC), and that's covered by LDC IIRC. The C++ ABI (Itanium mangling, not the MSVC one) should be okay-ish; there might be differences wrt. what's considered a POD between MinGW and MSVC. Exception handling almost certainly doesn't work; TLS may likely not work either.

In general, druntime and Phobos don't fully support MinGW[-w64], but if you restrict yourself to -betterC code, that might not be a problem.

How can I use D in this situation, where I need it to work directly with C data? building DLLs is not going to work here for that reason.

With -betterC, generating mixed DLLs shouldn't be any trouble at all.

Reply via email to