Results 1 to 2 of 2

Thread: .dll .lib

  1. #1
    Join Date
    Jun 2011
    Posts
    197
    Thanks
    6
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default .dll .lib

    Hello,

    I'm trying to create my own library and include it in my own project, however I'm a bit stuck. I've managed to compile a .dll however when I go to add it into my project using the technique from:

    http://qt-project.org/doc/qtcreator-...libraries.html

    I can't see the .dll file and the only type of file that the pop up window allows is a .lib. Two questions arise:

    1.) Firstly, how does one compile a .lib file? I have tried:

    Qt Code:
    1. TEMPLATE = lib
    2. CONFIG += staticlib
    To copy to clipboard, switch view to plain text mode 

    as per http://qt-project.org/doc/qt-4.8/qma...-projects.html

    however, with this, I'm unable to get anything to compile, I just get the .o and .a files to be created but no binary.

    Qt Code:
    1. TEMPLATE = lib
    2. CONFIG += dll
    To copy to clipboard, switch view to plain text mode 

    works fine, a .dll is created without any problems.

    2.) Secondly why isn't it possible to add a .dll file using the method of right clicking in the .pro file and clicking 'add library'? Is there a way of doing this? (apart from manually adding all the fields - the whole reason why I'm doing it using a wizard is to see what needs to be added... tried saving some time, but in the end, would have probably been quicker to read up on the .pro documentation and just do it manually but anyway.)

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,688
    Thanks
    13
    Thanked 1,598 Times in 1,526 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: .dll .lib

    1) The libsomething.a file is the static library. You are clearly using the GCC compiler/tools while reading advice for/from people using the Microsoft compiler/tools. The MS tools create static libraries in files name something.lib.

    2) On Windows your linker will use a "link library" that contains stub code to load and use a matching dynamic library at run time. The "link library" matching something.dll will be named libsomething.a or something.lib under MinGW and Microsoft tools respectively. You cannot (in general) link a DLL without the matching link library. Under some circumstances MinGW will allow you to directly link against a DLL but that is not portable behaviour.

  3. The following user says thank you to ChrisW67 for this useful post:

    Atomic_Sheep (22nd May 2014)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.