d bare bones

eles eles at eles.com
Fri Sep 6 06:34:32 PDT 2013


On Friday, 6 September 2013 at 10:43:38 UTC, Iain Buclaw wrote:
> On 6 September 2013 10:35, eles <eles at eles.com> wrote:
> Back to volatile.... the only (faintly close) alternative is 
> 'shared'.

After some thinking, it wasn't about synchronization between 
threads as the error message was misleading. Was not about 
volatile statements, but about the POD volatile variables as in 
C, marked like that for the compiler to never optimize away their 
effect.

That is, whenever you write:

*p=3;
a=*p;

it should not blindly assume that a=3, since p could be the 
address of some hardware register, with continuously changing 
(ie: volatile) content. Besides, writing and reading to hardware 
registers (mapped address) has a side effect (a hardware one).

So, as a workaround, I dropped the volatile keyword in front of 
my variables and imposed the -O0 flag on the compiler, to avoid 
any optimization.

I still find myself facing those error:

undefined reference to `_Dmodule_ref'

(actually, the error message is printed *twice*, but *for the 
same line*).

Any clues?



More information about the D.gnu mailing list