Consider the following minimal code in threadbug.d:
import core.thread;
void main() { }
Running
rdmd threadbug.d
gives many linker error messages stating that the core.thread functions are present in both the rdmd-generated temporary "threadbug.o" and the libphobos1.a library file; for instance:
/usr/opt/dmd2/linux/lib/libphobos2.a(thread_42_258.o): In function `_D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread':
core/thread.d:(.text._D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread+0x0): multiple definition of `_D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread'
/tmp/rdmd-threadbug.d-90B05FDCCD9547CEC2BBFC3765364CC0/threadbug.o:/usr/opt/dmd2/src/druntime/import/core/sys/posix/sched.d:(.text._D4core6thread6Thread6__ctorMFPFZvkZC4core6thread6Thread+0x0): first defined here
Running
dmd -run threadbug.d
gives no errors.
It appears that rdmd's include-all-dependencies-in-the-o-file approach lacks the proper exception for core.thread.
Comment #1 by andrei — 2011-01-09T08:50:13Z
This has been fixed a while ago. rdmd considers any module starting with "core." a library module.