difference in the content of Dll and Lib

This is a discussion on difference in the content of Dll and Lib within the C++ Programming forums, part of the General Programming Boards category; Hi, There are some questions regarding dll and library . I know,static library files are linked statically by linker at ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Location
    New York
    Posts
    24

    difference in the content of Dll and Lib

    Hi,

    There are some questions regarding dll and library .

    I know,static library files are linked statically by linker at start up.On the other hand dll was used to link the required functions(code)at run time.

    But, to link a dll why do we need an .lib file also.(As for a dll we have (1) an .h file - to compile against and (2)a .lib file to link agianst and (3)a .dll file itself.)?

    What are the difference in the contents of .dll and .lib??

    Why can't we have a .dll inspite of .lib and .dll???

    Thanks and Regards,

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    A .lib file contains functions that are linked in at link time (that is, when you are combining the results of the compilation into an executable file).

    For DLL's, in the way it works with Windows, the lib for a DLL contains "stub functions", which essentially is a jump to the relevant location in the DLL. There is also a reference in the .lib file that makes it possible to build the "DLL import table", which tells the loader (the part of the OS that loads executable files [including DLL's]) what DLL's are needed, and which functions in the DLL that are being used (and a reference to where in the original file that particular function is used - that is, where the stub is).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Link DLL with Visual C++ not working
    By status() in forum C++ Programming
    Replies: 3
    Last Post: 06-30-2006, 03:47 PM
  2. DLL compiling question
    By Noose in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2004, 07:16 AM
  3. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 09:19 PM
  4. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 05:29 AM
  5. Passing parameters from VB to C++ through ActiveX DLL
    By torbjorn in forum Windows Programming
    Replies: 0
    Last Post: 12-10-2002, 03:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21