Information Systems



How to create a .lib file from a .dll

Sometimes you only have a dll file and you want a lib file. Here's how to get a lib file from a dll.

1. You need some version of Visual C++. Run the vsvars32.bat file to get all the application paths correct.

2. dumpbin /exports dllfile.dll > libfile.def

3. Format libfile.def to look like a def file. Something like:

EXPORTS
function1
function2
...

3. lib /def:libfile.def /OUT:libfile.lib

Note that whatever is the final name of the dll should be the name of libfile.def. For instance an application will search for libfile.dll when compiled with the above settings even if you rename libfile.lib.