extern(C) function declaration inside a function without altering mangling

Timothee Cour via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 6 16:15:30 PDT 2014


Is there way to declare a extern(C) function inside a function without
altering the mangled name?

Should I write a mixin for that based on pragma(mangleof) (used as
extern_C_global_scope in example below) ? Or did someone already implement
that?

extern(C) void foo1();
void fun(){
extern(C) void foo2();
mixin(extern_C_global_scope("void foo3()"));
foo1(); //OK
foo2();  //will result in link error due to different mangling of foo2.
foo3();  //OK
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140906/08bd52e9/attachment.html>


More information about the Digitalmars-d-learn mailing list