Thread overview
std.boxer useless
Nov 07, 2005
Tim Starling
Nov 07, 2005
Vathix
Re: std.boxer (does do unittesting)
Nov 07, 2005
David L. Davis
Nov 07, 2005
Tim Starling
Nov 07, 2005
David L. Davis
Re: std.boxer (does do unittesting) opps...here's the link
Nov 07, 2005
David L. Davis
Nov 07, 2005
Tomás Rossi
Nov 07, 2005
Sean Kelly
November 07, 2005
I know this has been reported before, e.g.

http://www.digitalmars.com/d/archives/digitalmars/D/bugs/4444.html

but I thought some agitation might be required. What exactly is the point of std.boxer if you can't link to it without -release? I'd rather forget about std.boxer and find some other workaround, than throw away all D's testing and debugging features.

Can't you just package two versions of phobos.lib, one compiled with -release and one not? Then hack dmd to link the right one?

-- Tim Starling


import std.boxer;

int main()
{
	// Convert the integer 45 into a box.
    Box b = box(45);

    // Recover the integer and cast it to real.
    real r = unbox!(real)(b);

	return 0;
}

$ dmd
Digital Mars D Compiler v0.138
[...]

$ dmd boxtest.d
c:\dmd\bin\..\..\dm\bin\link.exe boxtest,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

boxtest.obj(boxtest)
 Error 42: Symbol Undefined _assert_3std5boxer
--- errorlevel 1
November 07, 2005
On Sun, 06 Nov 2005 21:36:15 -0500, Tim Starling <t.starling@physics.unimelb.edu.au> wrote:

> I know this has been reported before, e.g.
>
> http://www.digitalmars.com/d/archives/digitalmars/D/bugs/4444.html
>
> but I thought some agitation might be required. What exactly is the point of
> std.boxer if you can't link to it without -release? I'd rather forget about
> std.boxer and find some other workaround, than throw away all D's testing
> and debugging features.
>
> Can't you just package two versions of phobos.lib, one compiled with
> -release and one not? Then hack dmd to link the right one?

Plus there's a quasi mode when neither -debug nor -release are used; more link issues.
November 07, 2005
In article <dkmeiv$1o5g$1@digitaldaemon.com>, Tim Starling says...
>
>I know this has been reported before, e.g.
>
>http://www.digitalmars.com/d/archives/digitalmars/D/bugs/4444.html
>
>but I thought some agitation might be required. What exactly is the point of std.boxer if you can't link to it without -release? I'd rather forget about std.boxer and find some other workaround, than throw away all D's testing and debugging features.
>
>Can't you just package two versions of phobos.lib, one compiled with -release and one not? Then hack dmd to link the right one?
>
>-- Tim Starling
>
>
>import std.boxer;
>
>int main()
>{
>	// Convert the integer 45 into a box.
>    Box b = box(45);
>
>    // Recover the integer and cast it to real.
>    real r = unbox!(real)(b);
>
>	return 0;
>}
>
>$ dmd
>Digital Mars D Compiler v0.138
>[...]
>
>$ dmd boxtest.d
>c:\dmd\bin\..\..\dm\bin\link.exe boxtest,,,user32+kernel32/noi;
>OPTLINK (R) for Win32  Release 7.50B1
>Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
>
>boxtest.obj(boxtest)
> Error 42: Symbol Undefined _assert_3std5boxer
>--- errorlevel 1

Tim Starling,

Burton Radons gave a one liner (as used below) which does allow std.boxer unittesting in one of his posted a month or so back (I don't have the link handy at the moment). Hopefully you'll find this small example code helpful.

# // boxunittest.d
# // Release version : dmd boxunittest.d -release
# // Unittest version: dmd boxunittest.d -debug=test -unittest
# private import std.stdio;
# private import std.boxer;
#
# // Burton Radons <burton-radons[at]smocky[dot]com>
# // Allows -unittest for testing without the need for the -release switch
# debug(test) extern (C) void assert_3std5boxer() { }
#
# int main()
# {
#     Box boxx;
#
#     boxx = box(1234e+12+456e+5i);
#     writefln("(main) boxx=%g", unbox!(cdouble)(boxx));
#
#     return 0;
# }
#
# debug( test )
# {
# unittest
# {
#     Box boxx = box(1234e+12+456e+5i);
#     cdouble cd = unbox!(cdouble)(boxx);
#
#     assert(cd == 1234e+12+456e+5i);
#     writefln("(unittest) boxx=%g", cd);
# }
# }

Output:
---------
C:\dmd>dmd boxunittest.d -debug=test -unittest C:\dmd\bin\..\..\dm\bin\link.exe boxunittest,,,user32+kernel32/noi;

C:\dmd>boxunittest
(unittest) boxx=1.234e+15+4.56e+07i
(main) boxx=1.234e+15+4.56e+07i

C:\dmd>dmd boxunittest.d -release
C:\dmd\bin\..\..\dm\bin\link.exe boxunittest,,,user32+kernel32/noi;

C:\dmd>boxunittest
(main) boxx=1.234e+15+4.56e+07i

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
November 07, 2005
David L. Davis wrote:
> # debug(test) extern (C) void assert_3std5boxer() { }

Thanks for the tip, but I hope the existence of a workaround like this won't delay the implementation of a fix. Or if there is no intention to fix it, could the workaround above be documented in the manual?

-- Tim Starling
November 07, 2005
I ran into this problem with Ares.  std.boxer should be compiled in debug mode into Phobos.  The alternative is, as you suggest, to supply both release and debug versions of Phobos.


Sean
November 07, 2005
In article <dkmrva$21bt$1@digitaldaemon.com>, Tim Starling says...
>
>David L. Davis wrote:
>> # debug(test) extern (C) void assert_3std5boxer() { }
>
>Thanks for the tip, but I hope the existence of a workaround like this won't delay the implementation of a fix. Or if there is no intention to fix it, could the workaround above be documented in the manual?
>
>-- Tim Starling

Here's the thread that this tip pops up in, just look at the next to last message posted. In which it appears that Burton Radons has given Walter this fix for std.boxer, and that he was hoping to see it in dmd v0.130. So, I guess giving Walter a friendly reminder on this issue would help in moving this fix in sooner, rather than later. <g>

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
November 07, 2005
In article <dkmrva$21bt$1@digitaldaemon.com>, Tim Starling says...
>
>David L. Davis wrote:
>> # debug(test) extern (C) void assert_3std5boxer() { }
>
>Thanks for the tip, but I hope the existence of a workaround like this won't delay the implementation of a fix. Or if there is no intention to fix it, could the workaround above be documented in the manual?
>
>-- Tim Starling

opps! Here's the link: http://www.digitalmars.com/d/archives/digitalmars/D/learn/1661.html

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
November 07, 2005
In article <dkmrva$21bt$1@digitaldaemon.com>, Tim Starling says...
>
>David L. Davis wrote:
>> # debug(test) extern (C) void assert_3std5boxer() { }
>
>Thanks for the tip, but I hope the existence of a workaround like this won't delay the implementation of a fix. Or if there is no intention to fix it, could the workaround above be documented in the manual?
>
>-- Tim Starling

I agree!

Tom