Add ImportC compiler to dmd
Brian
bcallah at openbsd.org
Mon May 10 02:00:26 UTC 2021
On Monday, 10 May 2021 at 01:53:26 UTC, Walter Bright wrote:
> On 5/9/2021 6:13 PM, Max Haughton wrote:
>> ```
>> #include <stdio.h>
>> inline int square(int num) {
>> return num * num;
>> }
>>
>> int main()
>> {
>> printf("%d\n", square(3));
>> }
>> ```
>> fails to link in C but not in C++.
>
> I just tried it with gcc, it links. It does not with clang.
> Examination of clang's output shows it treated it as extern. I
> don't really understand what's going on with clang here, but
> that code will work with DMD.
It links on clang 11.0.1 here at -O2 or higher (including -Os and
-Oz).
Also links with pcc -O and even tcc!
More information about the Digitalmars-d
mailing list