Generation of function pointers

Plus 2 small changes for VC++ 2010/.NET 4 compatibility.