Thread overview
[Issue 384] New: Different behaviour when compiling as separate object files
Sep 27, 2006
d-bugmail
Nov 14, 2006
d-bugmail
Nov 25, 2006
d-bugmail
September 27, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=384

           Summary: Different behaviour when compiling as separate object
                    files
           Product: D
           Version: 0.167
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: aarti@interia.pl


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.


-- 

November 14, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=384





------- Comment #1 from aarti@interia.pl  2006-11-14 14:20 -------
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.


-- 

November 25, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=384


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla@digitalmars.com  2006-11-25 03:51 -------
Fixed DMD 0.175


--