www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - extern(C) function declaration inside a function without altering

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
}
Sep 06 2014