extern(C) names are being mangled; that's crazy, Walter says I'm crazy
Patrick Schluter
Patrick.Schluter at bbox.fr
Fri Jul 26 13:04:43 UTC 2019
On Friday, 26 July 2019 at 12:55:10 UTC, Patrick Schluter wrote:
> On Wednesday, 24 July 2019 at 23:05:33 UTC, Walter Bright wrote:
>> On 7/24/2019 2:24 PM, Manu wrote:
>>> In that callback case, they're effectively anonymously named
>>> functions...
>>
>> Yet they are given a name, and extern(C) to get the right
>> calling convention.
>
> I think the issue here is one of definitions and I think I
> understand why Walter and Manu do not understand each others
> point.
>
> For Manu extern(?) is mostly about mangling and secondarily
> about calling convention.
> For Walter, its first and foremost about calling convention.
> The mangling being unimportant as it can be explicitly set with
> mangle.
>
> When looking at what the specs says [1] it's clear that extern
> is more about calling conventions than mangling
>
> [1]: https://dlang.org/spec/attribute.html#linkage
To clarify. The issue here is that extern(?) is one keyword
acting on 2 different things that are only loosely linked: the
calling convention and the naming convention. What the different
versions (C, C++, D, Windows, System, Objective-C) actually
really do is very sketchy and not well defined and can even
change from platform to platform (C++ mangles differently on
Windows and Linux afaik).
More information about the Digitalmars-d
mailing list