static this() not executed
    Robert M. Münch 
    robert.muench at saphirion.com
       
    Wed May  8 17:47:35 UTC 2019
    
    
  
On 2019-05-08 17:37:38 +0000, Robert M. Münch said:
> // a.d
> module a;
> claas A {
> 	static myTemplate!A app;
> 
> 	static this() {
> 		app = new myTemplate!A;
> 	}
> }
> 
> void startup(State s){
> 	s.app = A.app;
> }
> 
> // b.d
> main(){
> 	State mainState = new State;
> 
> 	startup(mainState);
> }
> 
> The first problem I have is, that I can set a breakpoint on the static 
> constructor but it's never executed.
That was because I'm starting the D runtime manually and that call came later.
However, A.app is still NULL even after the static constructor run.
-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
    
    
More information about the Digitalmars-d-learn
mailing list