Results 1 to 12 of 12

Thread: Share QApplication instance (exe and dll)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Location
    Atlanta, GA
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Unhappy Re: Share QApplication instance (exe and dll)

    That doesn't seem to work, since it will not be the same instance (a problem with sharing singletons across dlls).

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Share QApplication instance (exe and dll)

    Don't link to static libs then. It's not a problem of sharing singletons across dlls, but across static libs. Shared objects would work fine.

  3. #3
    Join Date
    Oct 2007
    Location
    Atlanta, GA
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Share QApplication instance (exe and dll)

    Quote Originally Posted by wysota View Post
    It's not a problem of sharing singletons across dlls, but across static libs
    You are correct. That's what I should have said above. I would love to just use the Qt dynamic libs but that's not an option for the project I'm working on. So... I'm still looking for a way to solve this issue.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Share QApplication instance (exe and dll)

    If you link to Qt libs two times, you are wasting space. What is the reason of linking both the executable and the shared object against static Qt libraries?

  5. #5
    Join Date
    Oct 2007
    Location
    Atlanta, GA
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Share QApplication instance (exe and dll)

    Thanks for helping me out on this one. The shared library is used by the Qt exe that I mentioned and another non-Qt application. When I launch from the non-Qt app I just create a QCoreApplication object to process events while the lib does its work.

    Quote Originally Posted by wysota
    What is the reason of linking both the executable and the shared object against static Qt libraries?
    The Qt based exe links to (this is off the top of my head, I'm not near the machine I'm working on this... heh... it's the weekend ):

    qmain
    qtcore
    qtgui

    The shared lib links to:

    qtcore
    qtnetwork
    qtxml

    Is there something I'm doing wrong here?

    Once again, thanks for staying with me on this one.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Share QApplication instance (exe and dll)

    You didn't understand my question. You said that you have to link statically. Why?

  7. #7
    Join Date
    Oct 2007
    Location
    Atlanta, GA
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Share QApplication instance (exe and dll)

    Quote Originally Posted by wysota View Post
    You said that you have to link statically. Why?
    It was a matter of not wanting to ship the Qt Dlls. This is not a decision that I had a big part in.

    I will try to bring up the idea of using dynamic libraries instead of trying to link statically. Thanks for all your help.

  8. #8
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Share QApplication instance (exe and dll)

    how about instead of linking to a dll, just building another stand-alone exe (that will do the QHttp work) that you just launch from your main exe?
    Software Engineer



  9. #9
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Share QApplication instance (exe and dll)

    I'd suggest linking the DLL against ALL the Qt libs needed (by both app and dll itself) and then just linking the executable against the DLL but I'm not sure static linking would ensure all requested symbols would be embedded into the DLL....
    Current Qt projects : QCodeEdit, RotiDeCode

  10. The following user says thank you to fullmetalcoder for this useful post:

    gfunk (18th October 2007)

  11. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Share QApplication instance (exe and dll)

    Quote Originally Posted by cquinones View Post
    It was a matter of not wanting to ship the Qt Dlls.
    You ship other DLLs - like plugins, so what's the reason for not shipping Qt libs? This would reduce the volume of the final package. You can even strip down the Qt DLLs of everything you don't need if you want to to further reduce the size of the package.

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.