[Issue 18046] New: dmd -unittest doesn't work when linking against a shared library

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 7 22:16:21 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=18046

          Issue ID: 18046
           Summary: dmd -unittest doesn't work when linking against a
                    shared library
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: timothee.cour2 at gmail.com

on OSX, dmd -unittest doesn't work when linking against a shared library (but
works when linking against a static library): even though main2.d was compiled
with -unittest, main2's unittest isn't called.

dmd --version
DMD64 D Compiler v2.077.0

dmd -of=build//libfoo.dylib -shared -unittest foo.d
dmd -unittest -ofbuild/./main -L-lfoo -L-Lbuild/ main2.d foo.d
build/./main
u:foo

rm build//libfoo.dylib

dmd -of=build//libfoo.a -lib -unittest foo.d
dmd -unittest -ofbuild/./main -L-lfoo -L-Lbuild/ main2.d foo.d
build/./main
u:main2
u:foo


#####
./main2.d:
module main2;

import std.stdio;
import foo;

void main(){}

unittest{
        import std.stdio;
        writeln("u:main2");
}


./foo.d:
module foo;
void fun(){}

unittest{
        import std.stdio;
        writeln("u:foo");
}

--


More information about the Digitalmars-d-bugs mailing list