Function Pointer Not Working

Marcone marcone at email.com
Thu Nov 19 04:23:13 UTC 2020


// Function threadingw()
void threadingw(HWND hwn, void delegate() fun) nothrow {
	try {
		// Function _fun()
		extern(Windows)
		uint _fun(void * arg){
			(*(cast(void delegate()*) arg))(); // Do not show "Hello 
World!" :(
			return 0;
		}
		CreateThread(null, 0, &_fun, &fun, 0, null);
	} catch(Throwable){}
}

void main(){
	null.threadingw({writeln("Hello World!");});

}


More information about the Digitalmars-d-learn mailing list