[Issue 3364] New: module with unittest forces entire import chain
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 5 05:59:34 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3364
Summary: module with unittest forces entire import chain
Product: D
Version: 2.032
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dfj1esp02 at sneakemail.com
--- Comment #0 from Sobirari Muhomori <dfj1esp02 at sneakemail.com> 2009-10-05 05:59:32 PDT ---
This bug forces link of any module that indirectly imports any module with
unittest (nearly ANY module) even when I compile without -unittest switch. It
forced me to link in a module working with registry, thus forcing dependency on
extra library advapi32.dll even when I didn't use anything from that module,
this just killed me.
I'm not sure whether this is one bug or two, but together they are fearful.
test.d
---
import test2;
int main()
{
return 0;
}
---
test2.d
---
module test2;
import test3;
---
test3.d
---
module test3;
import test4;
extern void Foo();
void Goo()
{
switch("c")
{
case "a": break; //comment this line
case "b": break;
case "c": break;
case "d": break;
default: break;
}
Foo();
}
---
test4.d
---
module test4;
unittest
{
}
---
As you see, the main module does basically nothing, everything compiles, but
doesn't link. First I tried this command.
>dmd test.d -oftest.exe
OPTLINK (R) for Win32 Release 8.00.1
Copyright (C) Digital Mars 1989-2004 All rights reserved.
test.obj(test)
Error 42: Symbol Undefined _D5test212__ModuleInfoZ
--- errorlevel 1
It clearly misses test2 module. But why? test2 is nearly empty, there's nothing
to link from there! Linker doesn't calm down until you compile and link all 4
modules. Then...
>dmd test.d test2.d test3.d test4.d -oftest.exe
OPTLINK (R) for Win32 Release 8.00.1
Copyright (C) Digital Mars 1989-2004 All rights reserved.
test.obj(test)
Error 42: Symbol Undefined _D5test33FooFZv
--- errorlevel 1
Now comment case "a" line in test3 and it links. I don't understand, why.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list