Add ImportC compiler to dmd

Iain Buclaw ibuclaw at gdcproject.org
Thu May 13 21:04:13 UTC 2021


On Thursday, 13 May 2021 at 01:37:55 UTC, Walter Bright wrote:
> On 5/12/2021 4:24 AM, Iain Buclaw wrote:
>> Integration is another matter though, as all GCC compilers 
>> know about all languages that have been enabled, and what file 
>> extensions they handle.  i.e: `gdc foo.c bar.d baz.go` will 
>> invoke the C, D and Go compilers separately in one execution 
>> step:
>> ```
>> cpp foo.c -o foo.i;
>> cc1 foo.i -o foo.o;
>> d21 bar.d -o bar.o;
>> go1 baz.go -o baz.o;
>> ld foo.o bar.o baz.o -o a.out
>> ```
>
> I don't see any conflict there, either. While
>
>     dmd foo.c
>
> will compile C and generate an executable, so will
>
>     gdc foo.c
>
> It'll just use a different C compiler.

Well, either one of, or two things will happen:

1. People will raise bugs against dmd because `gdc foo.c` will be 
able to compile more code than dmd (and do preprocessing).

2. People will raise bugs against gdc because `gdc -finline foo.c 
bar.d` doesn't inline C functions into bar.

I meant conflicts will happen if I change the current behavior so 
make it so the D compiler handles C sources too i.e: `d21 bar.d 
foo.c -o bar.o`.



More information about the Digitalmars-d mailing list