Build problem with latest git head

Timo Sintonen t.sintonen at luukku.com
Sun Nov 10 05:37:03 PST 2013


On Sunday, 10 November 2013 at 09:20:11 UTC, Johannes Pfau wrote:
> In case you need a workaround right now:
> ----------------------------------------
> shared struct Register //Also working without shared here
> {
>     size_t a;
> }
>
> shared(Register*) reg = cast(shared(Register*))0xFFDDCCAA;
>
> void main()
> {
>      for(size_t i = 0; i < 10; i++)
>          reg.a = i;
> }
> ----------------------------------------
>
> But of course this needs to be fixed in gdc.

Yes, this works when I do it in main but not when I call the 
original member function.
The struct has to be marked shared in this case. Otherwise the 
compiler does not allow to call member functions with shared 
pointer. It still does not work.
It works when I move the function out of the struct. Thanks to 
ufcs, I do not have to change any other code: sendtext(uart,text) 
is the same than uart.sendtext(text)

I think the problem is here: when outside, the functon gets the 
real pointer with all additions. When inside, the function gets 
only bare 'this' without additional info.

I have no idea what to do for this but now I have a workaround 
and I can get one step ahead again.


More information about the D.gnu mailing list