How to make a .lib file when have a .dll file and a header file

You’re going to need Microsoft Visual C++ 2010 Express (or any other source of MSVC command line tools), and your DLL.

Steps:

  1. dumpbin /EXPORTS yourfile.dll > yourfile.exports
  2. Paste the names of the needed functions from yourfile.exports into a new yourfile.def file. Add a line with the word EXPORTS at the top of this file.
  3. Run the following commands from VC\bin directory (the one where lib.exe and other compile tools reside).

 

 vcvars32.bat

 lib /def:yourfile.def /out:yourfile.lib

or for x64 builds

 lib /def:yourfile.def /machine:x64 /out:yourfile64.lib

You should get two files generated: yourfile.lib and yourfile.exp

Leave a Comment