So, the compiler can produce a .def
file for a .dll, but (I'm guessing) the reason this is not used here is that you want to have control as to what the names and placement of the symbols are - in particular, since the .dll uses __stdcall, not _cdecl type calling convention.
Here's a page that describes some of the particularities with gcc/mingw and DLL's, including how to use your own .def file:
http://www.mingw.org/wiki/MSVC_and_MinGW_DLLs
In particular, the dlltool
:
dlltool -U -d testdll.def -l libtestdll.a