Bug 384 – Different behaviour when compiling as separate object files

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
Linux
Creation time
2006-09-27T16:30:00Z
Last change time
2014-02-15T13:18:39Z
Keywords
link-failure
Assigned to
bugzilla
Creator
aarti

Comments

Comment #0 by aarti — 2006-09-27T16:30:41Z
Below simple test case: mod.d ---- import submod; void main() { auto v = new myClass!(int)(); v.func(5); } ---- submod.d ---- module submod; import std.boxer; class myClass(T) { public: void func(T v) { Box b = std.boxer.box(v); } } ------------- dmd mod.d submod.d -->>> OK ------------- dmd -g -I/usr/local/src_d/phobos -c submod.d -ofobj/Debug/submod.o dmd -g -I/usr/local/src_d/phobos -c test.d -ofobj/Debug/test.o gcc -o test -m32 -Xlinker -ldl obj/Debug/submod.o obj/Debug/test.o -lpthread -lm -lphobos obj/Debug/test.o: In function `_D6submod14__T7myClassTiZ7myClass4funcFiZv':/home/marcin/Programy/D/tst1/test.d:6: undefined reference to `_arguments_i' :/home/marcin/Programy/D/tst1/test.d:6: undefined reference to `_arguments_i' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 3 seconds) ----------------------------- Similar error is happen when compiling "Any" (http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.announce&artnum=4827) dmd -g -I/home/marcin/Programy/D/ -I/usr/local/src_d/phobos -c any.d -ofobj/Debug/any.o dmd -g -I/home/marcin/Programy/D/ -I/usr/local/src_d/phobos -c test_any.d -ofobj/Debug/test_any.o gcc -o test_any -m32 -Xlinker -ldl obj/Debug/any.o obj/Debug/test_any.o -lpthread -lm -lphobos obj/Debug/test_any.o: In function `_D5doost3any3any28__T7anyCastTC8test_any4TestZ7anyCastFC5doost3any3any3AnyZC8test_any4Test':/home/marcin/Programy/D/doost/any/test_any.d:87: undefined reference to `_init_24TypeInfo_C8test_any4Test' obj/Debug/test_any.o: In function `_D5doost3any3any27__T6HolderTC8test_any4TestZ6Holder4typeFZC8TypeInfo':/home/marcin/Programy/D/doost/any/test_any.d:38: undefined reference to `_init_24TypeInfo_C8test_any4Test' obj/Debug/test_any.o: In function `_D5doost3any3any15__T7anyCastTPxZ7anyCastFC5doost3any3any3AnyZPx':/home/marcin/Programy/D/doost/any/test_any.d:87: undefined reference to `_init_11TypeInfo_Px' obj/Debug/test_any.o: In function `_D5doost3any3any14__T6HolderTPxZ6Holder4typeFZC8TypeInfo':/home/marcin/Programy/D/doost/any/test_any.d:38: undefined reference to `_init_11TypeInfo_Px' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 3 seconds) Compiling with: dmd test_any.d any.d works properly... This bug makes problem when using CodeBlocks IDE for developing D programs.
Comment #1 by aarti — 2006-11-14T14:20:17Z
Additionally it disallows to use build - you have to add one by one every file to dmd commandline. For any serious project it is total blocker.
Comment #2 by bugzilla — 2006-11-25T03:51:55Z
Fixed DMD 0.175