[XviD-devel] how can I get xvidcore.lib

Edouard Gomez ed.gomez at free.fr
Mon Jul 5 16:14:51 CEST 2004


Selon krafzig at web.de:
> two days ago I started to learn XviD. 
> How can I produce the static library (xvidcore.lib) ? 
> Compiling the library I get only the dll but I would like to have a lib.What
> needs to be done in order to get the lib (using msvc)?When I compile the
> xvidcore.dll in msvc I get also xvidcore.dll.a and xvidcore.dll.exp - I don't
> know for what these files are ? Could someone explain this to me ?Thank you
> for your help. 

Ok a bit of win32 dev background may help:
- the dll contains the executable code (for foobar symbol, a __imp_foobar
function pointer is created).
- the .lib (or in our case the .dll.a) contains linking information against the
dll (in fact linking information for __imp_ pointers).
- the .exp contains export information, but i don't remember how it is used.

How all thins things work together:
When compiling stuff that uses a dll, the compiler replaces all your function
calls with a function indirection using the __imp_ pointers. These pointers are
initialized by the win32 dll loader so they point to the real code inside the
dll (previously mapped into process memory space). This is called runtime linking.

You have two ways to obtain this runtime linking:
- you ask msvc to link against the .dll.a/.lib generated at dll time compile. So
your executable tells win32 process loader it needs "x.dll and y.dll for symbols
myfunction at 28 and foobardoesitall at 0". The win32 loader knows it has to memory
map the x.dll and y.dll and initialize the foobardoesitall/myfunction pointers.
- you declare explicitly pointers to functions, and you use LoadLibrary
LoadFunction win32 api calls for loading the dll, and then initailize your
function pointers with the functions address.

Now you know how all this stuff works. You know you have to link against
libxvidcore.dll.a, and have the xvidcore.dll in the PATH (either . or
c:\winnt\system32 etc etc). Or you can use LoadLibrary/Function as we do in the
vfw frontend.

If you really really want a static .lib. Then you'll have to grab latest CVS
Head version, we added there some project files for static lib targets.

Have fun.

--
Edouard Gomez


More information about the XviD-devel mailing list