PDA

View Full Version : stand alone dll under qt application



ami
15th June 2010, 10:51
Hi,

I have non-Qt GUI application which use also Qt core application in one component of it to use Qt thread support.

I have also external dll base on Qt which create Qt application for GUI porpuse (extern C API).

When i try to load the dll and to create QApplication i got the error of multiple Qt applications which can't be done.

Is there a way to make the dll to be independent when i can load and use it regarless to the loader (which can be Qt application too) ?

Thanks,

Ami

high_flyer
15th June 2010, 10:58
I have non-Qt GUI application which use also Qt core application in one component of it to use Qt thread support.
You should not use a QApplication or QCoreApplication in a DLL, since the application using the DLL will have that.
You can use QThread in your DLL even if you do not use QCoreApplication in your DLL, since the application which loads the DLL has a QApplication running, and it will deal with the QThread or any Qt events.

ami
15th June 2010, 11:49
This dll is used also on consol application which don't have Qt application instanse.
This dll designed to be stand alone so it will loaded on several environments so it must have QApplication instanse

high_flyer
15th June 2010, 13:42
Well,you can design anything you want, but if you don't pay attention to the restrictions you have, it just wont work.
I would suggest to you to split that DLL in to two DLLs - one that hold the non Qt dependent functionality, and another which is Qt DLL.
This way you can have the non Qt DLL still offer functionality to non Qt applications.

Another option, which I am not sure if it has other problems, is that applications using your DLL will use its QApplication.
You might try declaring your QApplication variable as external.
The problem with this approach is, that Qt application that will need to link to this DLL will have to be designed specifically to work that way.