While it is perfectly ok to define an extern(C) function in a function method, I can't seem to get pragma(mangle, "...") on it to work. --- pragma(mangle, "Foo") // Ok extern(C) void foo(); void main() { pragma(mangle, "Bar") // Error.... extern(C) void bar(); } --- Any idea why?