gendef -a mydll.dll then, using the generated mydll.def: dlltool --kill-at --input-def mydll.def --output-lib libmydll.a