Results 1 to 6 of 6

Thread: Difference between .dll and .lib

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    Difference between .dll and .lib

    If I make a dll file and use it in a program, I have to have the dll for the program to run. If I make a .lib file, how does that work? Is it compiled into the exe or what?

  2. #2
    Megatron
    Guest
    I think the DLL is used for dynamic linking, whereas the LIB is used for static linking.

  3. #3
    jim mcnamara
    Guest
    Megatron is correct - and adding just a bit

    When you link to a reference in a .lib file, you don't necessarily suck the whole .lib file into your .exe. When you have a reference to a .dll, on the other hand, you have to have the whole .dll on any system that runs your code.

    The idea behind a .lib file is to make a piece of code you put on any system, with no worries abour portability. The idea behind a dll is to make a small executable, and you do have to watch movinf it from system to system.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    but a dll can be shared, so different programs that use the same dll can use the same copy (even in memory), whereas libs are there as many times the programs are there. This can be a waste of memory and explains why windows is based on dll - imagine every started app needs to have it's own copy of gdi32.dll, kernel32.dll and user32.dll in memory, maybe even kernel.exe, user.exe and gdi.exe (the 16-bit versions).
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    and the lib is compiled into the exe, yes
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6
    amac
    Guest
    When DLL's are created they are linked against any libraries required... kinda like an executable file. Whereas, static libraries are not. They are more like object code (.obj files).

    DLL's can also have resources compiled into them (eg. icons, bitmaps, menus, dialog templates, ect. ).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width