On Saturday, 9 August 2014 at 05:38:33 UTC, H. S. Teoh via Digitalmars-d wrote:
On Sat, Aug 09, 2014 at 05:08:09AM +0000, Mike via Digitalmars-d wrote:
The idea is to have the same module declaration in multiple files, but
guarded by `version`.

// port_linux.d
version (linux):
module port;

// port_windows.d
version (Windows):
module port;

Unfortunately, this fails to compile with the following error:
 Error: Declaration expected, not 'module'
[...]

What about this:

        // port.d
        module port;
        version(linux)
                public import port_linux;
        version(Windows)
                public import port_windows;

        // port_linux.d
        ... // Linux implementation here

        // port_windows.d
        ... // Windows implementation here


Doesn't that introduce a new namespace?

Reply via email to