[Qt-interest] Dynamically loading a DLL from ressources

Yves Bailly yves.bailly at sescoi.fr
Wed Feb 11 08:39:34 CET 2009


Hello all,

Here's what I tried in a small program (QtCreator RC1,
Qt450 RC1, WindowsXP, MinGW).

First, I created a resource file "ressources.qrc":
<RCC>
     <qresource prefix="/dlls" >
         <file>my_dll.dll</file>
     </qresource>
</RCC>
...and referenced it in the .pro file:
QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9
RESOURCES += ressources.qrc

Then in the main() function, I tried:

QLibrary my_dll(":/dlls/my_dll.dll");
my_dll.load();

...but the QLibrary::load() always fails, whereas it
works fine if I try to load the same DLL from disk file.

Am I doing something wrong? or is it simply impossible to
load a shared library through ressources?

Regards,

-- 
     /- Yves Bailly - Software developper  -\
     \- Sescoi France http://www.sescoi.fr -/
"The possible is done. The impossible is being done. For miracles,
thanks to allow a little delay."




More information about the Qt-interest-old mailing list