Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
May 22, 2005 The new std.boxer seems to be broken. :( | ||||
---|---|---|---|---|
| ||||
Following the exact example as was posted in the D forum recently, the new std.boxer.d is giving the below link error when the unbox functions are being used. Is this a bug, or have I done something wrong in the code? // WinXP SP2, dmd v0.125 # /+ # ' Source : Boxed.d - example of the box /unbox template # ' Author : Burton Radons <burton-radons@smocky.com> # ' Created: 06-May-2005 # ' Ref : http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/23272 # +/ # private import std.stdio; # private import std.boxer; // now in D v0.124 # # void main() # { # Box x = box(4); # int y = unbox!(int)(x); //<-- if commented out, no linker error # # Box z = box("foobar"); # char[] w = unbox!(char[])(z); //<-- if commented out, no linker error # # writefln("%s %s", x, y); # writefln("%s %s", z, w); # } Output: -------- C:\dmd>dmd boxed.d C:\dmd\bin\..\..\dm\bin\link.exe boxed,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved boxed.obj(boxed) Error 42: Symbol Undefined _assert_3std5boxer --- errorlevel 1 C:\dmd> David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html |
May 22, 2005 Re: The new std.boxer seems to be broken. :( | ||||
---|---|---|---|---|
| ||||
Posted in reply to David L. Davis | You should compile it in release mode and without unittest...
I'm not quite sure why it doesn't compile (and I really would like to know) if you try to compile it with unittest on and not in release mode.
David L. Davis wrote:
> Following the exact example as was posted in the D forum recently, the new
> std.boxer.d is giving the below link error when the unbox functions are being
> used. Is this a bug, or have I done something wrong in the code?
>
> // WinXP SP2, dmd v0.125
> # /+
> # ' Source : Boxed.d - example of the box /unbox template
> # ' Author : Burton Radons <burton-radons@smocky.com>
> # ' Created: 06-May-2005
> # ' Ref : http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/23272
> # +/
> # private import std.stdio;
> # private import std.boxer; // now in D v0.124
> #
> # void main()
> # {
> # Box x = box(4);
> # int y = unbox!(int)(x); //<-- if commented out, no linker error
> #
> # Box z = box("foobar");
> # char[] w = unbox!(char[])(z); //<-- if commented out, no linker error
> #
> # writefln("%s %s", x, y);
> # writefln("%s %s", z, w);
> # }
>
> Output:
> --------
> C:\dmd>dmd boxed.d
> C:\dmd\bin\..\..\dm\bin\link.exe boxed,,,user32+kernel32/noi;
> OPTLINK (R) for Win32 Release 7.50B1
> Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
>
> boxed.obj(boxed)
> Error 42: Symbol Undefined _assert_3std5boxer
> --- errorlevel 1
>
> C:\dmd>
>
> David L.
>
> -------------------------------------------------------------------
> "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
> -------------------------------------------------------------------
>
> MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
|
May 22, 2005 Re: The new std.boxer seems to be broken. :( | ||||
---|---|---|---|---|
| ||||
Posted in reply to Geert | In article <d6pmnb$1m94$1@digitaldaemon.com>, Geert says... > >You should compile it in release mode and without unittest... >I'm not quite sure why it doesn't compile (and I really would like to >know) if you try to compile it with unittest on and not in release mode. > Geert, thank you for your reply, "-release" does allow the code to link and run. David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html |
May 22, 2005 Re: The new std.boxer seems to be broken. :( | ||||
---|---|---|---|---|
| ||||
Posted in reply to David L. Davis | David L. Davis wrote:
> Following the exact example as was posted in the D forum recently, the new
> std.boxer.d is giving the below link error when the unbox functions are being
> used. Is this a bug, or have I done something wrong in the code?
Wow, this is a flash-back, I haven't seen that link error in years. This is caused because it's the first template in Phobos designed to be used by a client, so it's just exposed a code generation problem in templates when the -release flags are mismatched (Phobos is now compiled with -release).
Here's an example:
[module f - compiled with -release]
int i; // to keep the assert from being constfolded
template T ()
{
void T ()
{
assert (i);
}
}
[module g - compiled without -release]
import f;
void main ()
{
T! () ();
}
|
May 22, 2005 Re: The new std.boxer seems to be broken. :( | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | Burton Radons wrote:
> David L. Davis wrote:
>
>> Following the exact example as was posted in the D forum recently, the new
>> std.boxer.d is giving the below link error when the unbox functions are being
>> used. Is this a bug, or have I done something wrong in the code?
>
>
> Wow, this is a flash-back, I haven't seen that link error in years. This is caused because it's the first template in Phobos designed to be used by a client, so it's just exposed a code generation problem in templates when the -release flags are mismatched (Phobos is now compiled with -release).
Err, rather "the first template in Phobos designed to be used by a client that asserts". Forgot about stdarg.
|
Copyright © 1999-2021 by the D Language Foundation