View previous topic :: View next topic |
Author |
Message |
tbolsh
Joined: 26 Jul 2006 Posts: 7
|
Posted: Wed Aug 09, 2006 4:18 pm Post subject: Bug in DMD? |
|
|
Good afternoon!
So, I think I found a bug in DMD for linux (GDC works out fine). I am new to D and because of that I am not sure it is a bug.
So, try to compile the following program by dmd on linux:
Code: |
import std.boxer;
import std.stdio;
class Test{
char []txt;
this(char []txt) { this.txt = txt; }
char []toString(){ return txt; }
}
void main(char [][]args){
Test t1 = new Test("test");
Box tb = box( t1 );
Test t2 = unbox!(Test) (tb);
}
|
It will be compiled fine by dmd, but linker will spit out something like
Code: |
TestBoxer.o(.gnu.linkonce.t_D3std5boxer27__T5unboxTC9TestBoxer4TestZ5unboxFS3std5boxer3BoxZC9TestBoxer4Test+0x1a): In function `_D3std5boxer27__T5unboxTC9TestBoxer4TestZ5unboxFS3std5boxer3BoxZC9TestBoxer4Test':
TestBoxer.d: undefined reference to `_assert_3std5boxer'
collect2: ld returned 1 exit status
|
As far as I can understand it means that templates are incorrectly processed by DMD.
GDC works fine with this.
By the way - does somebody know why all the digitalmars forums are dead?
Is it temporary? Or they often like that?
Timofei. _________________ Timofei Bolshakov |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Wed Aug 09, 2006 5:59 pm Post subject: |
|
|
Quote: | It will be compiled fine by dmd, but linker will spit out something like |
Compile with the -release flag, and see if that helps. This is an old problem with std.boxer, or more broadly, with templates in compiled libraries in D.
Quote: | By the way - does somebody know why all the digitalmars forums are dead?
Is it temporary? Or they often like that? |
The web portal to the newsgroups has been down for a couple weeks, ever since the newsgroup servers were moved. However, you can still access the newsgroups, but you'll need a reader - since you're using Linux, give Mozilla Thunderbird a try. Then just direct it to news.digitalmars.com, and go to one of the digitalmars.D.* groups. Just don't go to the "D" group; that one is old and shouldn't be used anymore. |
|
Back to top |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Wed Aug 09, 2006 7:38 pm Post subject: |
|
|
You can also get around this issue by having a local copy of std.boxer and forcing it into your compiles. (I do this with Build any time I use Box's.) _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
tbolsh
Joined: 26 Jul 2006 Posts: 7
|
Posted: Thu Aug 10, 2006 7:38 am Post subject: |
|
|
WOW!
Thank you very much!
I like -release flag way more then having a local copy of std/boxer.d
It seems that I will include -release into my DFLAGS!
And I think I have to read what exactly it does ...
Timofei |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Thu Aug 10, 2006 8:14 am Post subject: Re: Web Interface to the Newsgroups |
|
|
tbolsh wrote: | By the way - does somebody know why all the digitalmars forums are dead? | Yes, but I don't know why it can't at least point to a page saying that the problem is being worked on.
tbolsh wrote: | Is it temporary? |
Hopefully, it is temporary.
Jan says he's working on a replacement of the old system.
tbolsh wrote: | Or they often like that? | I think it's unusual for Digital Mars to have part of the website to be down for this long.
More information about the newsgroups that you might find helpful: http://www.prowiki.org/wiki4d/wiki.cgi?NewsDmD |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Thu Aug 10, 2006 12:54 pm Post subject: |
|
|
Quote: | And I think I have to read what exactly it does ... |
Well, for one, it'll get rid of all debugging code. This includes any code you've placed inside a "debug" statement, and also turns off array bounds checking. Asserts are also disabled, except "assert(false)", which is a special case - it'll execute a halt instruction (or equivalent), throwing an OS exception.
So basically any runtime debugging checks are turned off. |
|
Back to top |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Thu Aug 10, 2006 10:18 pm Post subject: |
|
|
If you aren't averse to rebuilding Phobos, try changing this portion of linux.mak or win32.mak:
Code: | boxer.obj : std\boxer.d
$(DMD) -c $(DFLAGS) std\boxer.d |
to this:
Code: | boxer.obj : std\boxer.d
$(DMD) -c -debug $(DFLAGS) std\boxer.d |
This will generate the debug code for std.boxer so it is available if needed. If your app builds with -release set then std.boxer simply won't reference these functions and they won't be linked. |
|
Back to top |
|
|
|