View Full Version : Is it possible to add QT resources to a DLL?

25th August 2008, 08:38
I have a DLL in which I would like to embed a file using the Qt resource system. I do this for Qt EXEs all of the time without any problems. It seems like the Qt resource system manages resource at the application level however, and so I'm a little unclear if it would be possible to add Qt resources to a DLL. I also don't want the DLL's ability to have resources to interfere with any Qt executable which might be hosting the DLL in terms of its resources. Is it possible to build resource spaces at the DLL level?


25th August 2008, 11:14
There is no problem with Qt resources in .dll. Just add a RESOURCES += foo.qrc line to the .dll's .pro file as usual.

To prevent resource clashs, one typically creates 'namespaces' by naming the resources, say, ":mydll/images/image1.jpg" .

25th August 2008, 20:09
Thanks. I'll check that out. My DLL and app will not / may not have a QApplication, but I'm assuming that Q_INIT_RESOURCE() declarations are all that is needed to make the resource accessible...

Christina flowers
14th January 2017, 23:13
i have the same problem i want my application resources (icon,image,voice...) to be stored in a ddl file and you is in my appliacation how can i do that please

17th January 2017, 01:12
As the previous post in this thread says, you have to add a call to Q_INIT_RESOURCE() in the main.cpp file. If your DLL is named "MyDLL.dll", then:


The call should be placed -after- you have declared your QApplication variable instance.