Corrected calling convention on 32-bit Windows systems.

GDwrap.dll was using the wrong calling convention (cdecl instead of
stdcall), which just happened to work correctly on the unit tests.
This patch switches it to stdcall.

It also statically links in libgcc and adds a few minor cleanups.