Hello guys,

i'm creating a library for a windev application. Basically, i need this library to spawn a thread, listen for stuff inside this thread, and make results available in a queue.

So far i've created a bunch of functions exported by the DLL, the first one to make sure a QCoreApplication is created, the second one to destroy it when the windev program is done with the library.
Qt Code:
  1. QCoreApplication *coreApp = 0;
  2. DLLIFACE void SCPrepareLibrary () {
  3. if (!coreApp) {
  4. int argc = 0;
  5. coreApp = new QCoreApplication(argc, 0);
  6. }
  7. }
  8. DLLIFACE void SCFreeLibrary () {
  9. if (coreApp) {
  10. coreApp->exit();
  11. delete coreApp;
  12. coreApp = 0;
  13. }
  14. }
To copy to clipboard, switch view to plain text mode 

Now, i'm wondering... i know i've got to call exec on the coreApp so it handles it's event loop, but since i don't want neither of my DLL functions to be blocking, i don't know what to do.
The solution i have in mind would be to add coreApp->exec() in my preparation function, and ask the developers of the windev application to always call this one in a thread.

Can someone please tell me the direction to take? Any sample code, any webpage talking about how to make the event loop working in a DLL would be very appreciated...