digitalmars.D.learn - Confusion over version (xxx)
- Ken Barry (27/27) Aug 15 2008 Just learning D, working with GLFW and dmd 1.030 on WinXP. The files glf...
- Ken Barry (4/4) Aug 15 2008 Sorry, line
- Lars Ivar Igesund (18/56) Aug 15 2008 Behaviour in D changed at some point, so if you see examples/code that d...
Just learning D, working with GLFW and dmd 1.030 on WinXP. The files glfw.d, gl.d and glu.d shipped with the GLFW distribution contain the following... version (Win32) { extern (Windows): } version (linux) { extern (C): } ...which results in Symbol Undefined errors. One of the files contains a variation... version(Win32) extern(Windows): else extern(C): ...which results in a syntax error on the 'else'. I have tried all the variations I can think of, such as version(Win32) { extern(Windows): } else { extern(C): } which also results in Symbol Undefined errors. The only thing that works is... version(Win32): ...on it's own. So I'm confused and would really appreciate it if anyone can explain this behaviour.
Aug 15 2008
Sorry, line version(Win32): should read extern(Windows):
Aug 15 2008
Ken Barry wrote:Just learning D, working with GLFW and dmd 1.030 on WinXP. The files glfw.d, gl.d and glu.d shipped with the GLFW distribution contain the following... version (Win32) { extern (Windows): } version (linux) { extern (C): } ...which results in Symbol Undefined errors. One of the files contains a variation... version(Win32) extern(Windows): else extern(C): ...which results in a syntax error on the 'else'. I have tried all the variations I can think of, such as version(Win32) { extern(Windows): } else { extern(C): } which also results in Symbol Undefined errors. The only thing that works is... version(Win32): ...on it's own. So I'm confused and would really appreciate it if anyone can explain this behaviour.Behaviour in D changed at some point, so if you see examples/code that don't work, it is just too old. version (foo) { extern(something): } will only be applied to that version block, and so it won't apply to the symbols following below the version blocks. Either duplicate all symbols in each version block, or use extern (System): symbols ... System will then put in the correct extern depending on platform. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Aug 15 2008
Lars Ivar Igesund Wrote:Behaviour in D changed at some point, so if you see examples/code that don't work, it is just too old. version (foo) { extern(something): } will only be applied to that version block, and so it won't apply to the symbols following below the version blocks. Either duplicate all symbols in each version block, or use extern (System): symbols ... System will then put in the correct extern depending on platform. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the TangoThanks Lars, extern (System): works just fine :)
Aug 15 2008
Lars Ivar Igesund Wrote:Behaviour in D changed at some point, so if you see examples/code that don't work, it is just too old. version (foo) { extern(something): } will only be applied to that version block, and so it won't apply to the symbols following below the version blocks. Either duplicate all symbols in each version block, or use extern (System): symbols ... System will then put in the correct extern depending on platform. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the TangoThanks Lars, extern (System): works just fine :)
Aug 15 2008