Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Difference between *.lib and *.dll
Forum Updated to NodeBB v4.3 + New Features

Difference between *.lib and *.dll

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 6.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    durgeshK
    wrote on last edited by
    #1

    Hello everyone,

    Although, this may seem very trivial question I am thinking about it for a long time.
    Qt comes with two sets of files lib files as in QtCore4.lib and dll files as in QtCore4.dll. I am little confused on the content of both. On the usage front I know, where it's being used, but can't figure out what exactly is happening?

    While, the libs files are added in Additional Dependencies in Visual Studio, I need to supply the dll files with my executable. Why do i need to supply the dlls along with the executable?

    thanks
    durgesh

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      .lib files are using in linking, as the last stage of build process. DLLs are used by live applications.

      (Z(:^

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Tannin
        wrote on last edited by
        #3

        .lib files are static libraries to be linked into your binary at compile time, dlls are dynamic libraries, linked at start-up time.

        Usually when you have a library using dlls they also ship small stub-libs. Those lib files don't contain the actual functionality, they merely let you statically link to an interface that is compatible to the corresponding dll.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You can also think about it this way:

          .dll contains the actual code. If you had only the .dll you would have to call LoadLibrary and GetProcAddress (on Windows, or the Qt equivalents from QLibrary) to actually call any function.

          .lib contains the code that is statically linked into your executable to allow you to make the calls directly, without explicitly loading the dll. It does not contain the code of the functions.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            durgeshK
            wrote on last edited by
            #5

            Thanks everyone for prompt answers. :)

            Can anybody point me to some tutorial to create and use dlls/lib to be used in another projects.

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              There are tons of articles about it. Just goolge shared library tutorial with your favourite IDE.

              An example from "codeproject":http://www.codeproject.com/Articles/85391/Microsoft-Visual-C-Static-and-Dynamic-Libraries.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved