1

Does Qt-based dll can be used by another non qt-based app (without QApplication)? in that post I asked a question, but topic was marked as duplicate without any reason. I wish to know that, does Qt-based DLL (that use Qt network module) works without QCoreApplication or not? Using the QCoreApplication is prohibited! I'm using waitForConnected/waitForReadyRead/waitForBytesWritten/waitForEncrypted functions for sockets and I need to know is that DLL will works or I must to use any other library (POCO, libcurl, VMime or something else). QCoreApplication absence is the key condition of Qt-framework usage in that case (or I must rewrite the code without Qt).

BUY
  • 705
  • 1
  • 11
  • 30
Meteo ir3
  • 449
  • 8
  • 21
  • 1
    I think you'll need to explain *why* you can't use `QCoreApplication`. – G.M. May 29 '18 at 07:19
  • Do you realize that if the application using your library has no `QCoreApplication`, you can create it *inside* your library? If it is prohibited to create `QCoreApplication` inside the library, you really need to explain why are things arranged so. Basically, without `QCoreApplication` there are no Qt event loops and hence no working signals-slots. – Dmitry May 29 '18 at 08:09
  • DLL can be used in many different applications, qt-based for example. And how can I instantiate QCoreApplication if application, that uses DLL, already have the instance? – Meteo ir3 May 29 '18 at 08:35
  • 1
    The [dupe](https://stackoverflow.com/questions/2150488/using-a-qt-based-dll-in-a-non-qt-application) explains how to do precisely that -- check the return value from [`QCoreApplication::instance()`](http://doc.qt.io/qt-5/qcoreapplication.html#instance) and act accordingly. Or am I missing something? – G.M. May 29 '18 at 08:40
  • When I create an instance of QCoreApplication in my DLL, I need to call QCoreApplication::exec() for processing events etc. But calling this method will freeze my app (working continue only after exit). Sending functions from DLL will called on worker thread only and I don't understand how can I proceed events and use that DLL in that case. – Meteo ir3 May 29 '18 at 09:45
  • The [answer](https://stackoverflow.com/a/10434948/1217285) to the duplicate question shows how to call `QCoreApplication::exec` in a separate thread from the main one so that it doesn't block the main thread. – Dmitry May 29 '18 at 10:11

0 Answers0