Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[solved] DLL compilation outputs .a file, what is it?
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
IIRC in Windows you need .a file at link time and .dll at run-time.
can you elaborate a bit, please?
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.
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?
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.
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?
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.
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?
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 :)