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. [solved] DLL compilation outputs .a file, what is it?
Forum Updated to NodeBB v4.3 + New Features

[solved] DLL compilation outputs .a file, what is it?

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 2.6k 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.
  • T3STYT Offline
    T3STYT Offline
    T3STY
    wrote on last edited by
    #1

    I have downloaded the Lua 5.2.3 sources and imported the source files in an empty Qt project. After compilation for shared library (no errors) the output directory contains two non object (.o) files: lua5.2.dll and liblua5.2.a.
    Dumb deduction: I should be interested in the DLL file.
    Question is, what is that liblua5.2.a file? Why is it there? Do I need it?
    I remember static libraries used to have .a extension. Does this mean the compiler outputted both the static and the shared libraries? (I highly doubt this)

    Thank you in advance for any explanation!
    p.s. I can upload the files if you wish to have a look, just ask

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      IIRC in Windows you need .a file at link time and .dll at run-time.

      1 Reply Last reply
      0
      • T3STYT Offline
        T3STYT Offline
        T3STY
        wrote on last edited by
        #3

        can you elaborate a bit, please?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          I wanted to say that to link your application against shared library (.dll) you need to link it with corresponding static (.lib) import library.

          But I confused .a with .lib
          .a file is a static library in Unix world.

          1 Reply Last reply
          0
          • T3STYT Offline
            T3STYT Offline
            T3STY
            wrote on last edited by
            #5

            Speaking about code, say I want to use lua5.2.dll in my application, how would this involve the .a file? Should I #include it?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andreyc
              wrote on last edited by
              #6

              No you should not include it.
              You should include header files .h

              And add .a or .lib as a parameter for linker.

              If you use QtCreator then use add library "wizard":https://qt-project.org/doc/qtcreator/creator-project-qmake-libraries.html
              It will generate all correct options.

              1 Reply Last reply
              0
              • T3STYT Offline
                T3STYT Offline
                T3STY
                wrote on last edited by
                #7

                If I wanted to add that library without the wizard, would it be enough to use LIBS += some/path/to/mylib.a in my .pro file?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andreyc
                  wrote on last edited by
                  #8

                  I think so. But I did not build any Qt project for Windows yet.
                  See "LIBS":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#libs for more detals.

                  1 Reply Last reply
                  0
                  • T3STYT Offline
                    T3STYT Offline
                    T3STY
                    wrote on last edited by
                    #9

                    I was reading that page as well, but it only makes examples with .lib files. I guess that would be the same for .a files?
                    EDIT
                    Confirmed. The gcc compiler outputs .a files, while MSVC outputs .lib files. But both are handled with the same LIBS qmake variable.

                    Thank you very much for help, andreyc :)

                    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