Creating an import lib from a dll

dumpbin /exports somelib.dll > exports.txt
echo LIBRARY some > somelib.def
echo EXPORTS >> somelib.def
for /f "skip=19 tokens=4" %name in (exports.txt) do echo %name >> somelib.def
lib /def:somelib.def /out:somelib.dll.lib /machine:somelib.dll

To get the value for machine do dumpbin /headers somelib.dll | findstr machine
The options in the for command mean skip the first 19 lines and then output the 4th field which is the name of the exported function.

Leave a Reply

Your email address will not be published. Required fields are marked *