extern(C) symbol conflicts

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 27 23:49:44 PST 2015


On 1/27/2015 11:22 PM, Jacob Carlborg wrote:
> On 2015-01-27 21:31, Steven Schveighoffer wrote:
>
>> For instance, if one library tags it as pure, but another does not. I
>> think an error in that case is warranted.
>
> Yeah. Do the compiler need to look at the parameters as well? Even if you put
> const or immutable, it won't make difference on the C side. But it will probably
> be confusing if one is declared const and another is not.
>

C does not have name mangling, so:

   extern(C) void foo(int);
   extern(C) void foo(char);

will mangle to the same name, although D will regard them as different symbols. 
C++ treats extern"C" names the same way.


More information about the Digitalmars-d mailing list