Add ImportC compiler to dmd

Walter Bright newshound2 at digitalmars.com
Mon May 10 01:53:26 UTC 2021


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.


More information about the Digitalmars-d mailing list