WebAssembly _start or crt_constructor not get called.

learnfirst1 learnfirst1 at gmail.com
Fri Aug 10 08:45:07 UTC 2018


extern(C) {
	__gshared int counter = 1;
	pragma(crt_constructor) void ginit(){
		counter++;
	}
	
	int getCounter(){
		return counter;
	}

	void _start() {
		counter++;
	}
}
----------------------

build with ldc2 -mtriple=wasm32-unknown-unknown-wasm -betterC 
test.d -link-internally

I expect the getCounter return 3, but it return 0, is this a bug  
?


More information about the digitalmars-d-ldc mailing list