Can I typedef pointer to extern (C) function?

Rick Mann rmann-d-lang at latencyzero.com
Fri Jan 26 23:37:01 PST 2007


Rick Mann Wrote:

> I'm having trouble posting. If this succeeds, I'll post the rest in a follow-on.

So, I have the following example (gdc on Mac OS X, DMD 1.00-based):



alias extern (C) uint function()		EventHandlerProcPtr;

extern (C)
uint
func1()
{
	return 0;
}

uint
func2()
{
	return 0;
}

void
main()
{
	EventHandlerProcPtr p = &func1;
	EventHandlerProcPtr q = &func2;
}


/*
	Compiling with gdc generates the following errors:
	
	$ gdc callbacktest.d 
	callbacktest.d:23: Error: cannot implicitly convert expression (& func1) of type uint(C *)() to uint(*)()
	$ 

*/



More information about the Digitalmars-d mailing list