Ok cool, I'll start a new thread with the minGW code so I don't end up hijacking this one. I'll clean it up a bit first with comments to show where I made changes.
I'm using minGW 2.0.0.3, and as recommended on the website I upgraded two packages:
binutils 2.13.90.20021006-2
w32api-2.1
I'm using Cygwin version 2.249.2.5 to make my development experience a bit more unix-like, but I set up the path to make sure I'm using the minGW bin executables (e.g., gcc, dllwrap), and I made sure I was using the minGW versions of the libraries that I linked to, so I'm not sure if the Cygwin part is relevant to the end product.