Results 1 to 6 of 6

Thread: dynamic library with Qt4 dialogs in exported functions

  1. #1
    Join Date
    May 2010
    Posts
    23
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default dynamic library with Qt4 dialogs in exported functions

    I am trying to write a dynamic library to get access to some hardware, and use Qt for dialogs in exported functions.
    Now if I try to use it from another Qt application it works more or less (more in linux, less in windows), if I omit QApplication construction, otherwise it complains. On the other hand if I try to use the library from native win application I have to include QApplication calls, and even then it works really strange. And I have not tried it yet with gtk programs. What is the proper way of doing this?
    Last edited by Onanymous; 9th June 2010 at 18:39. Reason: forgot to subscibe

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: dynamic library with Qt4 dialogs in exported functions

    I don't understand:
    do you have a Qt application that links to a non Qt lib, or do you have a non Qt application that links to a Qt lib?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    May 2010
    Posts
    23
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: dynamic library with Qt4 dialogs in exported functions

    I have (or rather want to build) a .dll or .so file which exports functions with qt dialogs. and I want that .so or .dll to be usable by both qt and non-qt-based applications.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: dynamic library with Qt4 dialogs in exported functions

    Making it usable for non Qt applications is going to be VERY difficult due to the fact that you need the QApplication event loop, which will not allow another event loop (in principal), and I am not sure about how simple it will be to have a lib running QApplication in it.
    Almost any other way will probably be easier.
    For Qt applications just have a look in the docs about plugins.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    May 2010
    Posts
    23
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: dynamic library with Qt4 dialogs in exported functions

    Quote Originally Posted by high_flyer View Post
    Making it usable for non Qt applications is going to be VERY difficult due to the fact that you need the QApplication event loop, which will not allow another event loop (in principal), and I am not sure about how simple it will be to have a lib running QApplication in it.
    Almost any other way will probably be easier.
    For Qt applications just have a look in the docs about plugins.
    what are the other ways?
    is there a way to check that my lib was loaded by qt program? The rest can be solved somehow I guess.
    So the lib is going to be accessible only by qt applications? sounds a bit microsoftish, or maybe applish, ha?

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: dynamic library with Qt4 dialogs in exported functions

    Any other way is rethinking what you really want, and how to achieve it.
    If you tell us more about what is the result you are after, we might be able to suggest other ways to achieve it.

    So the lib is going to be accessible only by qt applications? sounds a bit microsoftish, or maybe applish, ha?
    No, it has nothing to do with that.
    For the very least, because Qt is open source, so you can really do anything you like.
    Its a matter of merging the event loops.
    I didn't say its impossible, just that its very hard - technically, not because Qt wants to dominate the world.

    Now lets start again.
    I am trying to write a dynamic library to get access to some hardware, and use Qt for dialogs in exported functions.
    This is not clear.
    Is it a hardware access lib, or a gui lib?
    Its a good idea not to mix the two.
    Why can't you have your hardware stuff in a lib, (write it in ANCI C/C++ so any one can access it) and write a Qt application for the GUI, that will link against the lib.
    This way, any one can write other GUI's, with any other tool kit, on any other platform, but use the same hardware lib.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QTForm in QT Dynamic Library
    By Kokos in forum Newbie
    Replies: 1
    Last Post: 17th February 2010, 15:56
  2. Linking Qt in a dynamic library
    By dave_mm0 in forum Qt Programming
    Replies: 4
    Last Post: 18th July 2009, 16:28
  3. How to use a Dynamic Link Library with QT / C++.
    By nivaldonicolau in forum Newbie
    Replies: 5
    Last Post: 29th April 2009, 14:05
  4. name of exported dll functions
    By vrudolf in forum General Programming
    Replies: 2
    Last Post: 30th July 2006, 20:18
  5. Howto: Use exported dll library functions in Qt
    By pedros09 in forum Qt Programming
    Replies: 2
    Last Post: 14th April 2006, 15:05

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.