Win32

More code / build file cleanups to make it build on win32.  
Why we choose pass by reference here? I thought we use pass by reference in other places for either consistency (`tspan` case) or for speed reason. But we call the copy command in line 1146 here, so this won't speed up. Is this required by Win32?