Results 1 to 3 of 3

Thread: Creating Qt shared library for non-Qt applications

  1. #1
    Join Date
    Nov 2010
    Location
    USA
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Creating Qt shared library for non-Qt applications

    Hello,

    I am using Qt 4.6.2 on Windows.
    I have a Qt DLL that is invoked from a non-Qt application. The DLL exports couple of C interface functions.
    The DLL does not create QApplication and does not have any user interface elements.
    The DLL is loaded dynamically and unloaded when not needed.

    I noticed that every time the DLL is loaded the count of semaphore handles of the process that loads the DLL increases. When the DLL is unloaded the handles are not freed.
    I searched for information on Qt cleanup, or anything that needs to be done before dynamically unloading Qt ... but did not find anything.


    In the DLL, I use QCoreApplication::addLibraryPath() and the classes QImage, QByteArray and QBuffer. All the DLL does is some image transformations.

    Does anyone know how can I prevent the leaked handles?

    Thanks,

    Dimitar

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Creating Qt shared library for non-Qt applications

    Quote Originally Posted by dimitar View Post
    In the DLL, I use QCoreApplication::addLibraryPath() and the classes QImage, QByteArray and QBuffer. All the DLL does is some image transformations.
    It does not make sense at all to use any of the Q...Application classes inside a library. It's a library, not a program.
    What do you want to achieve when you use addLibraryPath?

  3. #3
    Join Date
    Nov 2010
    Location
    USA
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Creating Qt shared library for non-Qt applications

    I am setting the path where the Qt plugins are. If I do not do that plugins are not found/loaded.
    You are right that this is a library. But is there any other way to set the library paths, and not touch Q...Application?
    Can it be done with environment variable(s) (like LD_LIBRARY_PATH)?

Similar Threads

  1. how to use shared library
    By assismvla in forum Qt Programming
    Replies: 3
    Last Post: 25th September 2009, 21:29
  2. Shared Library Creation
    By tntcoda in forum Qt Programming
    Replies: 1
    Last Post: 31st January 2009, 23:48
  3. Qt/Mac Shared Library
    By nareshqt in forum Qt Programming
    Replies: 0
    Last Post: 21st April 2008, 07:21
  4. so shared library problem
    By mtrpoland in forum Newbie
    Replies: 3
    Last Post: 13th August 2007, 21:51
  5. HOW TO - created and use shared library (.so)
    By big4mil in forum Qt Programming
    Replies: 4
    Last Post: 25th November 2006, 23:11

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.