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.
DLLIFACE void SCPrepareLibrary () {
if (!coreApp) {
int argc = 0;
}
}
DLLIFACE void SCFreeLibrary () {
if (coreApp) {
coreApp->exit();
delete coreApp;
coreApp = 0;
}
}
QCoreApplication *coreApp = 0;
DLLIFACE void SCPrepareLibrary () {
if (!coreApp) {
int argc = 0;
coreApp = new QCoreApplication(argc, 0);
}
}
DLLIFACE void SCFreeLibrary () {
if (coreApp) {
coreApp->exit();
delete coreApp;
coreApp = 0;
}
}
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...
Bookmarks