D - static constructors for modules / files ?
- Charles Sanders (26/26) Sep 19 2003 Sorry I havent gotten to use D that much , stretched on time like everyo...
- Charles Sanders (6/32) Sep 19 2003 Spoke to soon sorry, at the bottom here:
Sorry I havent gotten to use D that much , stretched on time like everyone here. I see this in stream.d --------------------- File stdin, stdout, stderr; version (Win32) { // API imports private extern(Windows) { private import windows; HANDLE GetStdHandle(DWORD); } static this() { // open standard I/O devices stdin = new File(GetStdHandle(-10), FileMode.In); stdout = new File(GetStdHandle(-11), FileMode.Out); stderr = new File(GetStdHandle(-12), FileMode.Out); } } and its outside of any class, is this a module initalizer ? Would I have to put this in a version statement or how could I use this in my own project ( i mean the seemingly anonymous static this() ) ? Thanks, Charles
Sep 19 2003
Spoke to soon sorry, at the bottom here: http://www.digitalmars.com/d/module.html Doh! "Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bke355$2877$1 digitaldaemon.com...Sorry I havent gotten to use D that much , stretched on time like everyone here. I see this in stream.d --------------------- File stdin, stdout, stderr; version (Win32) { // API imports private extern(Windows) { private import windows; HANDLE GetStdHandle(DWORD); } static this() { // open standard I/O devices stdin = new File(GetStdHandle(-10), FileMode.In); stdout = new File(GetStdHandle(-11), FileMode.Out); stderr = new File(GetStdHandle(-12), FileMode.Out); } } and its outside of any class, is this a module initalizer ? Would I havetoput this in a version statement or how could I use this in my own project ( i mean the seemingly anonymous static this() ) ? Thanks, Charles
Sep 19 2003