Difference between revisions of "GenerateLibFromDll"

From VideoLAN Wiki
Jump to navigation Jump to search
m
m (Reverted edits by Longcn (talk) to last revision by Edwardw)
Line 1: Line 1:
Jaw [http://www.zenithscrusher.com/ crusher] is firstly researched and developed in 1858. Due to its simple structure, stable and reliable work and convenient operation and maintenance, it had been widely applied in mining, quarrying, stone crushing and road and bridge construction since then.
+
from: [http://www.coderetard.com/2009/01/21/generate-a-lib-from-a-dll-with-visual-studio/ http://www.coderetard.com/2009/01/21/generate-a-lib-from-a-dll-with-visual-studio/]
  
Jaw crusher machine is mainly used for primarily crushing the raw materials, so that is also called primary jaw crusher or primary crushers.
+
== Introduction ==
  
Jaw crusher is one of the most important crushing machines in the stone crushing production line. It can be not only used for crushing stone materials, pebble and coal and be called stone jaw crusher, but used for manufacturing cement aggregate.
+
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.
 +
And all of this using only with Microsoft Visual Studio Tools!
  
crusher adopts good steel to extend its service life. This crushing plant has many features such as deep crushing chamber, both big and small feeding mouth, controllable feeding granularity and the production capacity is high. The biggest material feeding mouth can reach 1200mm*1500mm and 1500mm*2100mm.
+
In case you don't have Visual Studio you can download the free version here [http://www.microsoft.com/express/download Visual Studio Express].
  
Henan Mining Machinery Co., Ltd is the largest jaw crusher supplier in China and produces jaw crushing plant with various models. The main models are mini jaw crusher, PE jaw crusher. Welcome to our company for visit and purchase.
+
== Open a 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
 +
  ...
 +
 
 +
Alternatively, the following command will automatically generate the DEF file:
 +
 
 +
echo EXPORTS > libvlc.def
 +
for /f "usebackq tokens=4,* delims=_ " %i in (`dumpbin /exports "c:\Program Files\VideoLan\VLC\libvlc.dll"`) do if %i==libvlc echo %i_%j >> libvlc.def
 +
 
 +
== 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.
 +
 
 +
Et voila! You have it, now you can link against libvlc.lib in your program <nowiki>:-)</nowiki>
 +
 
 +
[[Category:LibVLC]]

Revision as of 22:52, 14 March 2014

from: http://www.coderetard.com/2009/01/21/generate-a-lib-from-a-dll-with-visual-studio/

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. And all of this using only with Microsoft Visual Studio Tools!

In case you don't have Visual Studio you can download the free version here Visual Studio Express.

Open a 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
...

Alternatively, the following command will automatically generate the DEF file:

echo EXPORTS > libvlc.def
for /f "usebackq tokens=4,* delims=_ " %i in (`dumpbin /exports "c:\Program Files\VideoLan\VLC\libvlc.dll"`) do if %i==libvlc echo %i_%j >> libvlc.def

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.

Et voila! You have it, now you can link against libvlc.lib in your program :-)