Comment #0 by golovanov_alexey — 2016-01-09T09:34:01Z
Created attachment 1572
reduced test case (see moduleB import)
From forum: http://forum.dlang.org/thread/[email protected]
OS: Windows 7 (32 bit)
DMD: 2.069.2 and 2.070.0-b1
RDMD: build 20160103
Problem: import inside function produced linker error then -g switch used.
Test files in attach:
moduleA.d
test\moduleB.d
test\moduleC.d
/////////////
module moduleA;
public void funcA () {
import test.moduleB: funcB;
return;
}
void main(string[] args) {
return;
}
/////////////
module test.moduleB;
//import test.moduleC: funcC; //this works
public void funcB () {
import test.moduleC: funcC; //linker error
funcC();
return;
}
/////////////
module test.moduleC;
public void funcC () {
return;
}
/////////////
C:\dmd2\windows\bin\rdmd.exe moduleA.d
//no errors, moduleA.exe created
C:\dmd2\windows\bin\rdmd.exe -g moduleA.d
Copyright (C) Digital Mars 1989-2013 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\Users\user\AppData\Local\Temp\.rdmd\rdmd-moduleA.d-D3D7676836384146D1D9D907CF20EC26\objs\moduleA.exe.obj(moduleA.exe)
Error 42: Symbol Undefined _D4test7moduleC5funcCFZv
--- errorlevel 1
Problem disappear, then i move import in test.modileB to global level:
/////////////
module test.moduleB;
import test.moduleC: funcC; //this works
public void funcB () {
//import test.moduleC: funcC; //linker error
funcC();
return;
}
/////////////
Comment #1 by golovanov_alexey — 2016-01-16T09:34:43Z
RDMD in both cases produces same rdmd.deps file in corresponding work dir.
And those rdmd.deps not contains any mention of moduleC.
Command dmd -deps=moduleA.deps moduleA.d
produces moduleA.deps file, which not contains any mention of moduleC too.
Is this DMD bug instead of RDMD ?
Comment #2 by golovanov_alexey — 2016-01-16T16:57:47Z
Comment #3 by golovanov_alexey — 2017-05-20T10:36:09Z
No. Issue 7016 fixed, but this 15533 sill exists.
DMD32 D Compiler v2.075.0-master-f546675.
Reduced test case.
C:\dmd2\windows\bin\rdmd.exe moduleA.d
//no errors, moduleA.exe created
C:\dmd2\windows\bin\rdmd.exe -g moduleA.d
OPTLINK (R) for Win32 Release 8.00.17
Copyright (C) Digital Mars 1989-2013 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\Users\gav\AppData\Local\Temp\.rdmd\rdmd-moduleA.d-8C1729D9769E4E70D93C65D738058ED2\objs\moduleA.exe.obj(moduleA.exe)
Error 42: Symbol Undefined _D4test7moduleC5funcCFZv
Error: linker exited with status 1
Comment #4 by pro.mathias.lang — 2021-01-09T21:57:36Z