digitalmars.D.bugs - [Issue 5739] New: versioned linkage declarations don't work
- d-bugmail puremagic.com (47/47) Mar 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5739
- d-bugmail puremagic.com (11/11) Mar 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5739
- d-bugmail puremagic.com (10/10) Mar 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5739
- d-bugmail puremagic.com (13/13) Mar 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5739
- d-bugmail puremagic.com (7/7) Mar 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5739
- d-bugmail puremagic.com (23/23) Mar 18 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5739
- d-bugmail puremagic.com (17/17) Mar 18 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5739
- d-bugmail puremagic.com (14/16) Jan 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5739
http://d.puremagic.com/issues/show_bug.cgi?id=5739 Summary: versioned linkage declarations don't work Product: D Version: D1 & D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid, rejects-valid, wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: mrmocool gmx.de --- Comment #0 from Trass3r <mrmocool gmx.de> 2011-03-15 04:51:51 PDT --- main.d: ======= import versionextern; void main() { foo(); } versionextern.d: ================ version = Bla; version(Bla) { extern(Windows): } else version(Blub) { extern(C): } void foo(); yields: Symbol Undefined _D13versionextern3fooFZv no matter what version is defined. removing the parentheses and else: version(Bla) extern(Windows): version(Blub) extern(C): even results in: main(5): Error: undefined identifier foo I'm not sure if this is a rejects-valid or accepts-invalid issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5739 Jacob Carlborg <doob me.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |doob me.com --- Comment #1 from Jacob Carlborg <doob me.com> 2011-03-15 05:47:14 PDT --- In this particular case you could use "extern (System)". But this should probably be fixed anyway. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5739 --- Comment #2 from Trass3r <mrmocool gmx.de> 2011-03-15 10:06:21 PDT --- Yep I know, but the original code is like: version(CL_VERSION_1_1) extern(System): else extern(C): -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5739 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |INVALID --- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2011-03-15 11:34:16 PDT --- This is not a bug. A linkage declaration that ends in ':' runs to the end of the block, which in this case is the end of the version declaration. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5739 --- Comment #4 from Jacob Carlborg <doob me.com> 2011-03-15 12:30:42 PDT --- But how does he get "Error: undefined identifier foo"? Shouldn't "foo" just be declared as a regular function? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5739 Trass3r <mrmocool gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | --- Comment #5 from Trass3r <mrmocool gmx.de> 2011-03-18 02:45:55 PDT --- Yep, the second issue still persists. I found out what I originally wanted to do can be achieved via: extern(C): version(Bla) extern(Windows): // though replacing this with mixin("extern(Windows):"); doesn't work, then extern(C) wins void foo(); But as soon as you have 2 blocks like version(Bla) extern(Windows): version(Blub) extern(C++): and Blub isn't set, it fails with "undefined identifier foo" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5739 --- Comment #6 from Trass3r <mrmocool gmx.de> 2011-03-18 02:57:13 PDT --- Ah never mind, turns out it doesn't work. extern(C): version(Bla) extern(Windows): void foo(); fails as soon as Bla isn't defined. I guess it has to do with the parser. Because of the ':' it probably gets read like: version(Bla) { extern(Windows): void foo(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5739 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |INVALID --- Comment #7 from Walter Bright <bugzilla digitalmars.com> 2012-01-20 18:57:36 PST --- (In reply to comment #4)But how does he get "Error: undefined identifier foo"? Shouldn't "foo" just be declared as a regular function?It gets parsed like: extern(C): void foo(); and so foo is undefined. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2012