https://issues.dlang.org/show_bug.cgi?id=20012
Ethan Watson <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #26 from Ethan Watson <[email protected]> --- Bringing this over from my forum post. Here's two code snippets. export extern(C++) void fun() {} pragma( msg, fun.mangleof ); ---- mixin template M() { export extern(C++) void fun() {} } mixin M!(); pragma( msg, fun.mangleof ); ---- Both cases print the exact same mangle - _Z3funv on Linux, ?fun@@YAXXZ on Windows. This illustrates two things: 1) extern(C++) behavior inside mixins is correct. extern(C) behavior is not. 2) pragma( mangle ) is not a catch-all workaround if you are compiling for different architectures/operating systems with different ABIs The Wikipedia article on name mangling[1] goes in to detail on the messy history of mangling C functions in the Windows ecosystem, if you're worried that using C++ as a counter-point is irrelevant. [1] https://en.wikipedia.org/wiki/Name_mangling#C --
