Annotation of ChivanetAimPidgin/win32/dll2lib.bat, revision 1.1.1.1

1.1       snw         1: @echo off
                      2: 
                      3: REM Usage: dll2lib [32|64] some-file.dll
                      4: REM
                      5: REM Generates some-file.lib from some-file.dll, making an intermediate
                      6: REM some-file.def from the results of dumpbin /exports some-file.dll.
                      7: REM
                      8: REM Requires 'dumpbin' and 'lib' in PATH - run from VS developer prompt.
                      9: REM 
                     10: REM Script inspired by http://stackoverflow.com/questions/9946322/how-to-generate-an-import-library-lib-file-from-a-dll
                     11: SETLOCAL
                     12: if "%1"=="32" (set machine=x86) else (set machine=x64)
                     13: set dll_file=%2
                     14: set dll_file_no_ext=%~n2
                     15: set exports_file=%dll_file_no_ext%-exports.txt
                     16: set def_file=%dll_file_no_ext%.def
                     17: set lib_file=%dll_file_no_ext%.lib
                     18: set lib_name=%dll_file_no_ext%
                     19: 
                     20: dumpbin /exports %dll_file% > %exports_file%
                     21: 
                     22: echo LIBRARY %lib_name% > %def_file%
                     23: echo EXPORTS >> %def_file%
                     24: for /f "skip=19 tokens=1,4" %%A in (%exports_file%) do if NOT "%%B" == "" (echo %%B @%%A >> %def_file%)
                     25: 
                     26: lib /def:%def_file% /out:%lib_file% /machine:%machine%
                     27: 
                     28: REM Clean up temporary intermediate files
                     29: del %exports_file% %def_file% %dll_file_no_ext%.exp

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>