Patch to fix the Windows DLL build, and restore some backward compatibility.