GCC with D have been finally been released.

Johannes Pfau nospam at example.com
Tue May 7 21:13:57 UTC 2019


Am Tue, 07 May 2019 11:13:08 -0700 schrieb H. S. Teoh:

>> Will GDC be binary compatible with one or more of the already-existing
>> D compilers?
> 
> I just tested LDC and GDC, and they aren't compatible either. Probably
> because they each ship with their own version of Phobos, and link with
> their own C runtimes that aren't compatible with each other.
> 

Unfortunately the compilers are currently not ABI compatible. I think it 
shouldn't be too difficult to fix this though.

> 
>> Secondly, does it matter? (I'm still not clear on that.)
> 
> I think it's generally accepted that you have to use the same compiler
> to compile an entire program.  I've never heard of it being considered a
> bug that the output of two different compilers are incompatible.  It'd
> be great if it could somehow still work anyway, but generally I don't
> think it's expected to.
> 

Are you talking about D specifically or about any language in general? 
gcc and clang are abi compatible as far as I know and the same should be 
true for clang and msvc.

It is probably not necessary to be compatible on object file level, but at 
least shared libraries need to be compatible between compilers. Otherwise 
you will force linux distributions to choose only one compiler, as nobody 
wants to have 3 packages for every library (one for every compiler).

However, I don't think there are many compiler specific runtime hooks, so 
it should be possible to get e.g. gdc compiled code linking to a ldc 
compiled druntime. I guess the biggest problem here is exception handling.

-- 
Johannes


More information about the Digitalmars-d mailing list