Results 1 to 5 of 5

Thread: How to use a dll compiled by QT into QT

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default How to use a dll compiled by QT into QT

    I have seen a good explanation about create a DLL with QT to use with QT, but the author does not explain how to use inside my project.
    I would want to use a function, a macro, an entire class...

    I would appreciate some instructions.
    Last edited by tonnot; 19th November 2010 at 11:20.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use a dll compiled by QT into QT

    How do you want to use the DLL in in your project?

    Do you want your DLL to be loaded by the OS when your application is loaded? If so, you need to include the .lib file for the DLL in your .pro file. Examples of how to do this is specified in the qmake documentation.

    If you want to load the DLL at runtime, then have a look at QLibrary class in Qt documentation.

  3. #3
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use a dll compiled by QT into QT

    Thanks,
    First I want to load DLL at runtime. QTLibrary is some abstract for me, some example please?

    And, whats mean "Do you want your DLL to be loaded by the OS when your application is loaded?"
    Thanks again

  4. #4
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to use a dll compiled by QT into QT

    Both options load the module at runtime, but the second option (QLibrary/LoadLibrary) allows you to handle the case that the lib isn't available (even if it is just exiting gracefully and notifying the user). With the first option (using import lib), the OS module loader will simply fail to load your application in the event that the lib is not available. Using QLibrary/LoadLibrary is more robust but requires more code and more overall symbol management from the programmer.

  5. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use a dll compiled by QT into QT

    Examples of the usage of QLibrary are in the Qt documentation also. There's no point in me copying and pasting when the information is already there.

    For a more complete example, take a look at plugandpaint, also in the Qt distribution.

Similar Threads

  1. Replies: 3
    Last Post: 20th September 2010, 22:36
  2. Replies: 5
    Last Post: 30th January 2010, 10:05
  3. Qwt qch compiled help
    By MikeG in forum Qwt
    Replies: 4
    Last Post: 19th June 2009, 18:08
  4. 10 GB of compiled QT
    By QPlace in forum Installation and Deployment
    Replies: 13
    Last Post: 29th April 2009, 08:05
  5. Qt is compiled statically, now what ?
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 30th May 2006, 12:46

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
  •  
Qt is a trademark of The Qt Company.