October 07, 2004
"version (anything) :" (notice the colon) doesn't seem to work.

(some outputs removed)

>more test.d
version(linux):
void foo () {}

>dmd -c test.d
>lib -l test.obj
>more test.lst

Publics by name         module
_D4test3fooFZv                   test


Publics by module
test
        _D4test3fooFZv

>

That on Windows. On Linux, it's similar. Changing version(linux) for version(Windows):

$ dmd -c test.d
$ obj2asm test.d -ctest.asm
$ cat test.asm
FLAT    group
        public  _D4test3fooFZv

.text   segment
        assume  CS:.text
.text   ends
.data   segment
.data   ends
.bss    segment
.bss    ends
.rodata segment
.rodata ends
.gnu.linkonce.t_D4test3fooFZv   segment
        assume  CS:.gnu.linkonce.t_D4test3fooFZv
_D4test3fooFZv:
        55              push    EBP
        8B EC           mov     EBP,ESP
        5D              pop     EBP
        C3              ret
.gnu.linkonce.t_D4test3fooFZv   ends
        end
$

So dmd is ignoring version, thus including foo in the .obj (.o).
version(linux) { void foo() {} } or version(linux) void foo () { } work fine,
though.

-----------------------
Carlos Santander Bernal


October 08, 2004
added to dstress as svn://svn.kuehne.cn/dstress/compile/version_09.d

Thomas