>--def test.def
>EDIT: if the above doesn't work, try -Wl,--def=test.def
Didn't work, but helped me know what sort of thing to look for. Thanks.
So for anyone else looking to build a dll using the __stdcall (WINAPI) calling convention, without the name decoration MinGW (GCC) adds, then put this in CodeBlocks' "Other Linker Options":