I have 2 reduced files, wich i can't compile with new (DMD 2.066)
rdmd.exe under Windows 7 32-bit. Also confirmed on Linux (Ubuntu) x64
Command: rdmd --force --build-only aaa.d
Message "Error 42: Symbol Undefined _D3etc3bbb3fooFZi"
But command: dmd aaa.d etc\bbb.d
Compile without errors.
And then i replace rdmd.exe by old (from DMD 2.065) compile OK
too.
Sample code:
/*** begin of file aaa.d ***/
import etc.bbb;
void main()
{
int i = foo();
}
/***/
/*** begin of file etc\bbb.d ***/
module etc.bbb;
public int foo()
{
return 1;
}
/***/
Compiled:
$ rdmd --force --build-only -I../ aaa.d
/tmp/.rdmd-1000/rdmd-aaa.d-869564B02B64C83C3AB4137B2C9D7507/objs/aaa.o: In function `_Dmain':
aaa.d:(.text._Dmain+0x5): undefined reference to `_D3etc3bbb3fooFZi'
collect2: error: ld returned 1 exit status
If you change the module name everything works. i.e.
change `etc` to something else.
Comment #1 by dlang-bugzilla — 2014-08-23T17:35:15Z
As explained on the forum, "etc" is a package reserved for Phobos.
http://forum.dlang.org/post/[email protected]
I suppose we could narrow it down in rdmd to "etc.c" but really people shouldn't be mixing package names used in Phobos and in their code.
Comment #2 by public — 2014-08-23T17:39:29Z
Yes, this user code has always been invalid as it is using standard library package name.
Comment #3 by dev — 2014-08-23T17:42:10Z
Maybe a more descriptive error message could be introduced about reserved package names?
Comment #4 by dlang-bugzilla — 2014-08-23T17:48:16Z
I don't think that would be possible unless you knew whether a module is actually part of the standard library (phobos.lib) or not. But, if you solve that, you can solve the original problem since now you know whether to compile/link it or not.
Comment #5 by dlang-bugzilla — 2014-08-23T23:07:48Z
Closing, as I don't see how we could make things "just work" in all situations without writing a custom linker.