http://d.puremagic.com/issues/show_bug.cgi?id=6132
Summary: extern (C) Silently Ignored Within D Classes Product: D Version: D2 Platform: x86 OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: shero...@email.virginia.edu --- Comment #0 from Braxton Sherouse <shero...@email.virginia.edu> 2011-06-09 09:17:03 PDT --- Overview: I'm running DMD32 v2.053 on Mac OS X 10.6.7 and found the following inconsistency in name mangling: ==== extern(C) int clock(); // is mangled to _clock class Sprocket { extern(C) int clock(); // is mangled to __D4test8Sprocket5clockMUZi: } ==== Expected Results: The compiler should either: 1) mangle the declaration according to the C conventions by cause of the "extern (C)", or: 2) emit a compilation error because C doesn't have classes. Actual Results: The declaration is silently compiled according to the D conventions. Additional Information: While either solution would be welcomed, I'm working in context where solution 1 would save a lot of effort; I'm generating language/library bindings at compile time through the use of template metaprogramming. The code builds a (more robust) interface in D, and is just using the extern (C) to declare C functions that will later be linked in from other libraries. Maybe it would be possible for the compiler to allow this syntax when there is no function body, but fail when there is?? Many thanks! -braxton -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------