extern(C) declaration inside function

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Sep 13 06:53:36 PDT 2013


On 9/10/13, <luis at luismarques.eu>"@puremagic.com <"\"Luís".Marques"> wrote:
> When you declare an extern(C) function inside a D function it
> seems to continue to use D's name mangling, which is unexpected
> for me. For instance:
>
>      void main()
>      {
>          extern(C) void foo(int);
>          foo(42);
>      }

I was going to suggest using pragma(mangle, "...") as a workaround
(using a git-head compiler), but actually it won't work here because
this pragma can only be used in module-scope. Apparently there's a
difference between a pragma declaration and pragma statement, I'm not
sure why we have this split.


More information about the Digitalmars-d mailing list