Should C linkage (aka "extern (C)") be the default when using "betterC"?

max haughton maxhaton at gmail.com
Sat Mar 5 22:02:39 UTC 2022


On Saturday, 5 March 2022 at 20:48:45 UTC, rempas wrote:
> On Saturday, 5 March 2022 at 17:09:22 UTC, max haughton wrote:
>>
>> Basically pointless. The linkage of internal symbols has 
>> almost no relevance to a projects usability from C. You'd also 
>> be throwing away anything that requires name mangling, for 
>> zero real benefit.
>>
>> If you want to expose a symbol to C then use extern(C). This 
>> is not hard to do.
>
> Actually, we are saying the same thing. The only reason to use 
> C linkage is to "expose" symbols (aka allowing it to call it 
> with a known name) from C. This will allow your library to be 
> used from C and from any language that can use C linkage.

Which is trivially done now, whereas making it the default with 
betterC means you lose a bunch of D features


More information about the Digitalmars-d mailing list