Friday, September 20, 2013

Generate Lib From DLL

Introduction
To avoid installing and fighting against MSYS and Cygwin, you can just extract exported symbols from libvlc.dll to generate a .lib (libvlc.lib) and link your program against it.

Open Visual Studio Command Prompt
It can be found within the Visual Studio Tools menu entry:
Start / Program Files / Microsoft Visual Studio / Visual Studio Tools / Visual Studio Command Prompt.

Extract Symbols
Within the command prompt type:
dumpbin /exports "C:\Program Files\VideoLAN\VLC\libvlc.dll" > "C:\Program Files\VideoLAN\VLC\libvlc.def"
Edit the libvlc.def file and modify it to get something like this:
EXPORTS
libvlc_add_intf
libvlc_audio_get_channel
libvlc_audio_get_mute
libvlc_audio_get_track
libvlc_audio_get_track_count
libvlc_audio_get_track_description
libvlc_audio_get_volume
...
Generate the .lib
Still within the command prompt type:
lib /def:"C:\Program Files\VideoLAN\VLC\libvlc.def" /out:"C:\Program Files\VideoLAN\VLC\libvlc.lib" /machine:x86
Of course, you'll need to adapt the path according to your configuration.

Source
Generate Lib From DLL