std.boxer linker error

Brad Roberts braddr at puremagic.com
Thu Mar 2 17:38:00 PST 2006


On linux with dmd 0.148, I'm seeing some odd linking issues that I haven't 
tracked down just yet.

$ cat test_box.d
import std.boxer;

int main()
{
    Box foo = box(1);
    int bar = unbox!(int)(foo);

    return 0;
}

$ dmd -g -v 
test_box.d
parse     test_box
semantic  test_box
semantic2 test_box
semantic3 test_box
code      test_box
generating code for function 'main'
generating code for function 'unbox'
generating code for function 'unboxCastInteger'
gcc test_box.o -o test_box -g -lphobos -lpthread -lm -Xlinker -L/workplace/bradrob/dmd-0.148/dmd/lib 
test_box.o(.gnu.linkonce.t_D3std5boxer24__T16unboxCastIntegerTiZ16unboxCastIntegerFS3std5boxer3BoxZi+0x18): In function `_D3std5boxer24__T16unboxCastIntegerTiZ16unboxCastIntegerFS3std5boxer3BoxZi':
/workplace/bradrob/d-playground/test_box.d:5: undefined reference to `_assert_3std5boxer'
collect2: ld returned 1 exit status
--- errorlevel 1


Commenting out the assert in std/boxer.d inside unboxCastInteger(T) at 
line 429 allows the link to succeed.

Similarly, if I use something other than an int and hit one of the other 
unboxCast[pick a type] templates I get the same problem.

Thoughts?

Thanks,
Brad



More information about the Digitalmars-d-bugs mailing list