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

rempas rempas at tutanota.com
Sat Mar 5 20:48:45 UTC 2022


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.


More information about the Digitalmars-d mailing list