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.
-------
From Derek Parnell:
On Windows, you have to compile anything that imports std.boxer with the
"-release" switch to get the linker happy.
Comment #1 by sylverpyro — 2007-01-23T11:43:20Z
This issue is still present in the phobos library with dmd 1.00 (OS is linux)