Re: Using D libs in C

2011-03-22 Thread Dainius (GreatEmerald)
I've tried compiling the same on Linux and the program still crashes
(with segmentation fault there). No error message or anything. And it
doesn't matter if I compile the thing from .obj or from .lib files, I
still get the same crashes. So it's a real showtopper for me, since
what's the use of having static libraries that compile successfully
yet crash every time you attempt to use them?..

Anyone have any ideas about what's happening? Or should I just go
ahead and submit this to the bug tracker?


Re: Using D libs in C

2011-03-22 Thread Daniel Green

On 3/22/2011 6:46 PM, Dainius (GreatEmerald) wrote:

I've tried compiling the same on Linux and the program still crashes
(with segmentation fault there). No error message or anything. And it
doesn't matter if I compile the thing from .obj or from .lib files, I
still get the same crashes. So it's a real showtopper for me, since
what's the use of having static libraries that compile successfully
yet crash every time you attempt to use them?..

Anyone have any ideas about what's happening? Or should I just go
ahead and submit this to the bug tracker?


The D runtime needs to be initialized.  Call rt_init before using your 
library and rt_term when your done with it.


The D runtime replaces main with initialization code and renames the 
programs main to _Dmain.


extern (C) bool  rt_init( void delegate( Exception ) dg = null );
extern (C) bool  rt_term( void delegate( Exception ) dg = null );


TDPL 6.4.3 Overriding Is Only Voluntary

2011-03-22 Thread Caligo
"The override keyword in the signature of Friend.bgColor is required," (193)

This code compiles:

class Contact{ string bgColor(){ return ""; } }
class Friend : Contact{
string bgColor(){ return "LightGreen"; }
}

So how is 'override' required?  Can I get an example of where
'override' makes a difference?


Re: TDPL 6.4.3 Overriding Is Only Voluntary

2011-03-22 Thread Jonathan M Davis
> "The override keyword in the signature of Friend.bgColor is required,"
> (193)
> 
> This code compiles:
> 
> class Contact{ string bgColor(){ return ""; } }
> class Friend : Contact{
> string bgColor(){ return "LightGreen"; }
> }
> 
> So how is 'override' required?  Can I get an example of where
> 'override' makes a difference?

dmd is behind TDPL on several counts. This is one of them ( 
http://d.puremagic.com/issues/show_bug.cgi?id=3836 ). Eventually, override 
_will_ be required. Right now, it's only required when compiling with -w.

- Jonathan M Davis